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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to