On Mon, 24 Sep 2007, Vimal wrote: > Hi all, > > I was surprised to find out that the following piece of code: > > > length [1..] > 10 > > isnt lazily evaluated! I wouldnt expect this to be a bug, but > in this case, shouldnt the computation end when the length function > evaluation goes something like: > > > 10 + length [11..] > > ? >
If you used genericLength and had it returning this type with an appropriate Num instance: data Nat = Zero | Succ Nat then it'd be sufficiently lazy. As it is, an Int is something you either have or don't - you can't only evaluate "is it less than x" without having to fully evaluate it. -- [EMAIL PROTECTED] "The reason for this is simple yet profound. Equations of the form x = x are completely useless. All interesting equations are of the form x = y." -- John C. Baez _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe