[Haskell-cafe] Shouldnt this be lazy too?

Andrew Coppin andrewcoppin at btinternet.com
Mon Sep 24 17:09:25 EDT 2007

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.

More information about the Haskell-Cafe mailing list