caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Yaron Minsky" <yminsky@cs.cornell.edu>
To: "Caml Mailing List" <caml-list@inria.fr>
Subject: Re: Overriding an entry in a polymorphic variant
Date: Thu, 31 Aug 2006 18:04:43 -0400	[thread overview]
Message-ID: <891bd3390608311504g13cf0ea6x2cbb0a79cfd29760@mail.gmail.com> (raw)
In-Reply-To: <891bd3390608311458v5de0651qd8a38a896c77c72d@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

On 8/31/06, Yaron Minsky <yminsky@cs.cornell.edu> wrote:
>
> Does anyone know if there is a clean way of overriding a field in a
> polymorhphic variant.  I want to do something like this:
>
> type bot = [ `bot ]
> type top = [`bot | `top]
> type t = [ `a of bot | `b of bot | `c of bot | `d of bot | `e of bot ]
> type t1 = [ t | `c of top  | `e of top ]
>
> the desired end result being that t1 is actually [ `a of bot | `b of bot |
> `c of top | `d of bot | `e of top ].  I'm hoping to do this largely to
> enable some phantom-types hackery I'm working on.  I'm not sure it matters
> from the point of view of whether this is doable, but it is potentially
> relevant that bot is a subtype of top.
>

Small addendum:  I'm still not sure this is relevant, but I did get my
example slightly backwards.  top should be a subtype of bot, not the other
way.  So the definitions of bot and top should be:

type bot = [ `bot |  `top]
type top = [`top]

[-- Attachment #2: Type: text/html, Size: 1294 bytes --]

  reply	other threads:[~2006-08-31 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-31 21:58 Yaron Minsky
2006-08-31 22:04 ` Yaron Minsky [this message]
2006-08-31 23:29   ` [Caml-list] " skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=891bd3390608311504g13cf0ea6x2cbb0a79cfd29760@mail.gmail.com \
    --to=yminsky@cs.cornell.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).