
24 Sep
2007
24 Sep
'07
9:09 p.m.
Neil Mitchell wrote:
Hi
Um... isn't a lazy natural just a list with no data, where the list length encodes a number?
Pretty much, yes.
So I just need to write newtype LazyNatural = LazyNatural [()] and then add some suitable instances. ;-) (Woah... that's one bizzare-looking type there!) Hey, the "length" function would then just be ln_length :: [x] -> LazyNatural ln_length = LazyNatural . map (const ()) Ooo, that's hard.