[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

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)

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


Y F 3



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


More information about the Haskell mailing list