3 ms·
If Haskell were lazy, then it wouldn't evaluate 2+3, but Haskell is non-strict, rather than lazy, so it can evaluate it, or not.
by chrisseaton 11y ago
If Haskell were lazy, then it wouldn't evaluate 2+3, but Haskell is non-strict, rather than lazy, so it can evaluate it, or not.
- hvidgaard 11y agoHaskell is lazy, but the compiler can be smart enough to know that 2+3 is semantically equal to 5 in it's model of computation. This is without violating the lazy nature of the language. So it can (and will I believe, but I haven't checked) fold any such expressions to their constant value when compiling for performance reasons.