[Haskell-cafe] Shouldnt this be lazy too?
Neil Mitchell
ndmitchell at gmail.com
Mon Sep 24 17:22:24 EDT 2007
Hi
> > Pretty much, yes.
> >
>
> So I just need to write
>
> newtype LazyNatural = LazyNatural [()]
or
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 :-)
Thanks
Neil
More information about the Haskell-Cafe
mailing list