Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] simple typing question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Vanier <mvanier@c...>
Subject: [Caml-list] simple typing question

I imagine this has been asked and answered before, so I apologize in
advance.

Compare these two functions:

# let f x = List.map (fun y -> y) x ;;
val f : 'a list -> 'a list = <fun>

and

# let f = List.map (fun y -> y) ;;
val f : '_a list -> '_a list = <fun>

Why does the second use the '_a type variable instead of 'a?  I thought
that special type variables only had to do with polymorphic references.
The FAQ states that the latter expression can't be generalized, but I don't
really understand why.

Mike
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners