[Haskell] Y in haskell?

Lloyd Allison Lloyd.Allison at infotech.monash.edu.au
Mon Apr 18 00:57:30 EDT 2005


Is it possible to define Y in Haskell (pref' H98) --
and get it to pass type checking?

--

E.g. As in SML

let
datatype 'a rt = recrt of ('a rt) -> 'a;

fun Y G    = let fun Ggg (recrt g) n = G(g (recrt g))n
	     in Ggg (recrt Ggg)
	     end;

fun F f n = if n=0 then 1 else n*f(n-1);

in

Y F 3

end

--

I've tried various things, some of which
*seem* to put the checker in a loop?

-L
--


More information about the Haskell mailing list