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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: [Caml-list] Polymorphic records typing question
Here's a puzzle for the Caml breeders:

# type poly = { f : 'a . 'a -> 'a };;
type poly = { f : 'a. 'a -> 'a; }
# let id x = x;;
val id : 'a -> 'a = <fun>
# let foo = { f = id };;
val foo : poly = {f = <fun>}
# let rec id x = x and foo = { f = id } ;;
This field value has type 'a -> 'a which is less general than 'b. 'b -> 'b

Why is this last recursive definition unacceptable?

Alex

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