And this works too :

let _ = () |! (fun z -> z);;

while this:

let _ = () |! (fun ?x z -> z);;

doesn't.

It appears that when the mandatory parameter is typed, the inference kernel doesn't fail, as seen with the unit type. Here's another working example:

let _ = 1 |! (fun ?x (z : int) -> z);;

didier


2012/11/16 Milan Stanojević <milanst@gmail.com>
>> I don't understand why foo1 is fine and foo2 isn't. I would have
>> thought that I can use foo2 wherever I can foo1 since it has a
>> strictly more general type.
>> Am I missing something obvious here?
>
> Its probably due to the optional labels, this works:
> let y = () |! foo2 ?x:None ?y:None

The question is why foo1 doesn't need this and foo2 does.

--
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