On Wed, Oct 17, 2007 at 05:43:08PM -0700, David Benbennick wrote:
> This module doesn't appear to be very lazy to me.  For example, in ghci,
> 
> *Util.LazyNum List> genericLength (1:2:undefined) > (1 :: Nat)
> *** Exception: Prelude.undefined
> 
> How is this module intended to be used?

Oops, sorry, the version I posted was an intermediate one that had a
different addition algorithm. here is a better one that fixes that issue:

Zero + y = y
Sum x n1 + y = Sum x (y + n1)  

note that it alternates the order in the recursive call, interleaving
the elements of the two arguments.

so, this is head-strict in the left argument, but tail-lazy in both. 

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to