Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2007-03-05 (08:02)
From: Jacques GARRIGUE <garrigue@m...>
Subject: Re: [Caml-list] Re: records with polymorphic variants?
From: Eliot Handelman <>
> Martin Jambon wrote:
> >
> > You can do this directly if you prefer:
> >
> > type 'a f = 'a
> >   constraint 'a = [> `A of int ]
> This is exactly what I was trying to do in the first place.
> Where exactly is the main documentation for this syntax? Not in
> JG's papers, unless I've missed something, as is possible.

It's not in my papers, because it is a rather subtle feature of the
type system, and is not directly related to type inference. It should
be in Vouillon&Remy's paper about objects.

It is documented in the manual, at the very end of section 6.8.1.
There are some examples involving objects (using the class syntax) in
section 3.10 of the tutorial.

Jacques Garrigue