From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 894A0BF5C for ; Fri, 1 Sep 2006 00:04:44 +0200 (CEST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.234]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7VM4h8V010096 for ; Fri, 1 Sep 2006 00:04:44 +0200 Received: by wx-out-0506.google.com with SMTP id s7so799885wxc for ; Thu, 31 Aug 2006 15:04:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=jtjAXGxxpRR9PtRJSRcdqvLIPrgUTePZyLh+n+V4s+T8jkb5UHdaJPQrb94ig97/X2WSP5206Rd9ReGvAWL1ixu21Sfbcw+jvA2xc28SdLK64s8o8pvO1wgr0PK295VFrJD759R4KDiydAcEsWTw18TKahnM9h5ensZvLcQzh7o= Received: by 10.70.32.2 with SMTP id f2mr2445016wxf; Thu, 31 Aug 2006 15:04:43 -0700 (PDT) Received: by 10.70.61.6 with HTTP; Thu, 31 Aug 2006 15:04:43 -0700 (PDT) Message-ID: <891bd3390608311504g13cf0ea6x2cbb0a79cfd29760@mail.gmail.com> Date: Thu, 31 Aug 2006 18:04:43 -0400 From: "Yaron Minsky" Sender: yminsky@gmail.com To: "Caml Mailing List" Subject: Re: Overriding an entry in a polymorphic variant In-Reply-To: <891bd3390608311458v5de0651qd8a38a896c77c72d@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_72797_6341815.1157061883424" References: <891bd3390608311458v5de0651qd8a38a896c77c72d@mail.gmail.com> X-Google-Sender-Auth: 8cb06604dfe9f9e8 X-Miltered: at nez-perce with ID 44F75CFB.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 overriding:01 yaron:01 minsky:01 yminsky:01 overriding:01 hackery:01 doable:01 subtype:01 subtype:01 hackery:01 doable:01 wrote:01 ------=_Part_72797_6341815.1157061883424 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/31/06, Yaron Minsky 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] ------=_Part_72797_6341815.1157061883424 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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]


------=_Part_72797_6341815.1157061883424--