[Haskell-cafe] Shouldnt this be lazy too?

Neil Mitchell ndmitchell at gmail.com
Mon Sep 24 17:53:40 EDT 2007


> I'm guessing there's going to be fairly minimal performance difference.
> (Or maybe there is. My way uses a few additional pointers. But it also
> allows me to elegantly recycle existing Prelude list functions, so...)

I think we can safely assume that people using peano numbers aren't
actually overly interested in performance...

> *ALL* the instances? No.
> A small handful of them? Sure. How about this...

How about creating a darcs repo, a cabal package and uploading it to hackage?

Two design decisions you made could have been done differently (not
sure which is best)

If you read the lazy naturals paper it says that 4 - 8 should be 0.
This follows the whole drop 8 [] = [], not _|_

Your show function is strict. Not sure whether this is a good idea or not.

You could also include the constant infinity in your library:

infinity = LN (repeat ())



More information about the Haskell-Cafe mailing list