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: | -- (:) |
| From: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] records with polymorphic variants? |
From: "Lukasz Stafiniak" <lukstafi@gmail.com>
> Try the syntax:
>
> # type r = {x : [> foo]};;
> Characters 14-21:
> type r = {x : [> foo]};;
> ^^^^^^^
> Unbound type parameter [..]
>
> The open variant type introduces a type parameter, which is not bound
> in definition of type r. I don't think these unnamed parameters can be
> bound, so that you could write:
The correct syntax in this case is
type r = {x : 'a. [> foo] as 'a}
Unfortunately there seems to be a bug in 3.09, so that it doesn't
work. This will work again in 3.10.
(This was a stupid bug, as usual. Other cases, like
type r = {x : 'a. <m : int; ..> as 'a}
do work in 3.09.)
Note that this seems not to be what the original poster wanted
actually, which was just a constrained type.
Jacques Garrigue