
24 Sep
2007
24 Sep
'07
4:28 p.m.
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 http://article.gmane.org/gmane.comp.lang.haskell.cafe/26329 Regards, apfelmus