Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Y combinator and type-checking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andy Yang <yyu08@y...>
Subject: [Caml-list] Why type infenere enter infinte loop here?
Hi, all

I am relatively new in Ocaml. Perhaps this problem is
trivial. With the following interactive process, ocaml
cannot give out f2's type. Could you tell me why it
cannot?
                                                      
                         
# let rec y f = f (fun x ->(y f) x);;
val y : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun>
# let g h x = h x;;
val g : ('a -> 'b) -> 'a -> 'b = <fun>
# let f1 = y g;;
val f1 : '_a -> 'b = <fun>
# let k x = x * x + 1;;
val k : int -> int = <fun>
# let f2 = f1 k;;

Thanks a lot!

Andy


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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