Hi,
There's an Ocaml language feature I do not understand.
E.g. in this example:
type 'a phantom = int
type t = { enter : 'a. 'a phantom -> int }
let f g = g.enter 2
let _ = f { enter = fun x -> 1 + x } (* ok *)
let _ = f { enter = (+) 1 } (* fails to typecheck *)
I don't get why, if we have:
type 'a phantom = int
i.e. "'a phantom" is defined as an alias of "int",
how is it possible that the following types:
{ enter : 'a. 'a phantom -> int }
is not equal to
{ enter : 'a. int -> int }
I've tried to find a corresponding section in the Reference Manual, but I failed.
Where is this explained?
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs