
24 Feb
2010
24 Feb
'10
3:41 p.m.
OCaml can do this: $ ocaml -rectypes Objective Caml version 3.11.1 # let fix f = (fun x -> f(x x)) (fun x y -> f(x x) y);; val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun> # fix (fun f -> function 0 -> 1 | n -> n*f(n-1)) 10;; - : int = 3628800 Haskell 98 doesn't seem to be able to type check that definition of the y-combinator directly. Is there a Haskell extension that would let it handle this? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e