[Haskell-cafe] Re: Shouldnt this be lazy too?

apfelmus apfelmus at quantentunnel.de
Mon Sep 24 12:28:59 EDT 2007

Vimal wrote:
> 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..]

That's the spirit, but you still need the right integer type for that :) 
I mean, Haskell does not magically detect that the 32(64)-bit integer 
(10 + length [11..]) :: Int  is bigger than  10 :: Int . But by using 
peano numbers, the comparison function can detect that, see also



More information about the Haskell-Cafe mailing list