Version française
Home     About     Download     Resources     Contact us    
Browse thread
records with polymorphic variants?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eliot Handelman <eliot@g...>
Subject: records with polymorphic variants?
Hi,

I'm trying to figure out how to define a record with a field whose type 
is an extensible polymorphic variant.

I can  this:

type f = [ `A of int ]

type r = { x : f }  

but then I can't do this:

{ x = `B "test" }

I'm not even sure if what I'm asking for is possible.

Guessing at the syntax I tried

type  r = {
    f :  [> #foo]
  }

which results in:

Warning D: this syntax is deprecated.
      f :  [> #foo]
              ^^^^
Characters 24-28:
      f :  [> #foo]
              ^^^^
The type [< foo ] is not a polymorphic variant type

I hope it is clear what I'm trying to do. Thanks for your help.

-- eliot