[Haskell-cafe] Strange subtract operator behavior - and lazy
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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe