[
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: | Jerome Vouillon <vouillon@c...> |
| Subject: | Re: As-binding #-types |
> #type 'a mytype = Mk of #myclass as 'a;;
> Unbound row variable in #myclass
In a type definition, type parameters *must* be free variables. But, here,
you try to bind the type parameter 'a to #myclass. So, this definition
fails. Actually, the compiler sees that #myclass contains a row variable
that obviously cannot be a type parameter, and hence rejects this phrase.
You can remove the constraint and just write
#type 'a mytype = Mk of 'a;;
I don't think omitting the type constraint is a problem in practice.
However, I plan to add constrained type definitions to the language in the
future. Then you will probably be able to write your type definition as
#type (#myclass as 'a) mytype = Mk of 'a;;
Jerome