Browse thread
records with polymorphic variants?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-03-04 (12:08) |
From: | Dmitri Boulytchev <db@t...> |
Subject: | Re: [Caml-list] records with polymorphic variants? |
Making type r polymorphic works fine: type 'a r = {x : 'a} let u = {x = `A 3} let v = {x = `B "test"} Best regards, Dmitry Boulytchev, St.Petersburg State University. > 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 > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >