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
Re: [Caml-list] Allowing many types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ceri Storey <cez@p...>
Subject: Re: [Caml-list] Allowing many types
On Sun, Feb 10, 2002 at 08:43:20PM -0500, Ryan Tarpine wrote:
> Is there a type that means "any polymorphic variant"?  Trying to set
>  type primitive = [ `PTest ]
> forces only `PTest to be the value of object_data.  How can I allow 
> anything to be stored there?

According to the output of the toplevel, then the type [> `Foo | `Bar ]
should be usable, but alas, it is not allowable in type specifictions,
giving "Unbound type parameter [..]". 

I've also tried just using plain tuples for this, but then lots of types
become ungeneralisable, eg in the trivial example:
# (fun x -> x) [`X; `Y; `Z];;
- : _[> `X | `Y | `Z] list = [`X; `Y; `Z]

So say, declaring such a variable in a complied module is impossible

Ceri Storey <>
vi(1)! postfix(7)! pie(5)!
Bug reports:  FAQ:
To unsubscribe, mail  Archives: