
7 Aug
2009
7 Aug
'09
9:37 a.m.
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