[Haskell-cafe] Strange subtract operator behavior - and lazy naturals

Lennart Augustsson lennart at augustsson.net
Wed Oct 17 16:16:47 EDT 2007


The one in the numbers package is not quite as clever as John's; it's the
naïve version of lazy naturals.

On 10/17/07, Stuart Cook < scook0 at gmail.com> wrote:
>
> On 10/17/07, John Meacham < john at repetae.net> wrote:
> > if anyone is interested, Although I bet this has been implemented a
> > hundred times over, I have attached my lazy naturals module below just
> > for larks. It is quite efficient as such things go and very lazy. for
> > instance (genericLength xs > 5) will only evaluate up to the 5th element
> > of the list before returning a result. and ((1 `div` 0) > 17) is true,
> > not bottom.
>
> > If anyone wants me to clean this up and package it as a real module, I
> > would be happy to do so.
>
> It looks like there's already a lazy-natural type in the "numbers"
> package on Hackage, but not having used it I have no idea what it's
> like.
>
>
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numbers-2007.9.25
> http://tinyurl.com/2pmthz
>
>
> Stuart
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071017/4a193da2/attachment-0001.htm


More information about the Haskell-Cafe mailing list