Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Polymorphic Variants and Objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jim Farrand <jim@f...>
Subject: [Caml-list] Polymorphic Variants and Objects

Take a look at the following OCaml class type definition:

class type foo =
  object
    method bar: [ `A | `B ] 
  end

I want to be able to relax the type of bar so that it can return any variant 
tag, rather than being limited to `A or `B.

Is this possible?  I tried

class type foo =
  object
    method bar: [> ] 
  end

but this is rejected on the grounds that

The method bar has type [> ] where .. is unbound

Any suggestions?

Regards,
Jim
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr