Hello, 2011/1/26 Jeremy Yallop > On 26 January 2011 12:58, Julien Signoles > wrote: > > How to convert the following ocaml 3.12 code into a typable ocaml < 3.12 > > code? > > I have a solution using Obj. Is it possible without Obj? > > There are safer approaches (than Obj) to a "universal type" described here: > > http://ocaml.janestreet.com/?q=node/18 > > Whether your problem can be solved with such an approach depends on > how flexible your definition of "the same [type]" is. You can > certainly write a function of the same type and behaviour as 'f' that > way, though. > I'm aware of such an universal type. It works fine for the small example of my original post. However I see no way to use it on my real case because it is a bit more complex. Actually it looks like: ===== (* val f: 'a u -> 'a list u *) type 'a u = ... (* a phantom type, defined in another file *) let f (type v) (x:v u) = let module S = F(struct type t = v u (* waiting a type t of the form w u for some w *) let x = x (* an additional list of operations over t *) let equal = ( = ) (* ... *) end) in (S.y : v list u) (* S.y is opaque: no way to destruct it *) ===== I see no way to inject and project values [x] and/or [S.y] to any universal type since the conversion from [x] to [S.y] is done internally by the functor F. Thanks for your help, Julien