Version française
Home     About     Download     Resources     Contact us    
Browse thread
Overriding an entry in a polymorphic variant
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yaron Minsky <yminsky@c...>
Subject: Overriding an entry in a polymorphic variant
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.

Thanks in advance,
y