[Haskell-cafe] Shouldnt this be lazy too?
ndmitchell at gmail.com
Mon Sep 24 17:22:24 EDT 2007
> > Pretty much, yes.
> So I just need to write
> newtype LazyNatural = LazyNatural [()]
data Nat = Zero | Succ Nat
it's your choice really.
> and then add some suitable instances. ;-)
Yes. Lots of them. Lots of instances and lots of methods.
> Hey, the "length" function would then just be
> ln_length :: [x] -> LazyNatural
> ln_length = LazyNatural . map (const ())
> Ooo, that's hard.
Nope, its really easy. Its just quite a bit of work filling in all the
instances. I bet you can't do it and upload the results to hackage
within 24 hours :-)
More information about the Haskell-Cafe