bug in language definition (strictness)
Malcolm Wallace
malcolm.wallace at cs.york.ac.uk
Fri Aug 7 05:37:21 EDT 2009
>> Yet I think it would be
>> valid to say that seq can turn a non-terminating (exceptioning)
>> program
>> into a terminating one.
>
> Do you have an example of that?
Sure.
foldl (+) 0 [1..10000000] :: Integer
*** Exception: stack overflow
foldl' (+) 0 [1..10000000] :: Integer
50000005000000
The only difference between foldl and foldl' is strictness (the use of
seq). By "non-terminating (exceptioning)" I of course really meant
"terminating with bottom" as opposed to "terminating with a defined
value", but since non-termination and exceptions are semantically both
bottom, you won't mind that slip. :-)
Regards,
Malcolm
More information about the Haskell-prime
mailing list