On Tuesday 28 July 2009 22:47:25 Aaron Bohannon wrote:
> let f (x : 'a) : 'a = x in (f true, f 3);;

Err, good question. :-)

# let f : _ = fun x -> x in f true, f 3;;
- : bool * int = (true, 3)
# let f : 'a = fun x -> x in f true, f 3;;
Error: This expression has type int but is here used with type bool

I'm guessing the scope of the 'a is not what you'd expect but I have no idea 
why. I'd have thought the latter would be a harmless type annotation...

Any takers?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

_______________________________________________
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

Reply via email to