On Wed, Dec 15, 2010 at 09:31:27AM +0100, Florent Ouchet wrote: > >Why is it that the first example does not compile while the later ones do? > Because type constraints are considered: > - only for type restriction, not for generalization;
Hmm, I thought specifying a type is always a restriction compared to saying nothing at all and thus allowing everything. > - after the type inference algorithm is executed. If I don't specify a type, what's the inferred type of f? If I restrict f to the exact same type it should do no harm. At least, that is what I expected. So, I do understand your explanations but I don't understand the reasons for them. I will go and consult the literature on the ML typing system. Thank you all for your replies. Greetings Alex
signature.asc
Description: Digital signature
_______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs