
Quoth Lennart Augustsson
Some examples of what might happen:
OK, these are interesting phenomena. From a practical point of view, though, I could see someone weighing the potential costs and benefits of a exception handler outside IO like this, and these effects might not even carry all that much weight. Does that make sense, or is the problem really more dire than I understand? I mean, it isn't the first time I've seen this explained in terms of predictability in a case where there are two possible exceptions, so I have to take for granted that this is a compelling argument to some, but it is evidently a matter of perspective. Donn
If you have more than one possible exception in your code, you don't know which one you will get. It can vary between compilers, optimization levels, program runs, or even evaluating the same expression within one program.
If you have code that have both an infinite loop and an exception you don't know if you'll get the loop or the exception.
Breaking the deterministic behaviour can lead to strange consequences, because the compiler relies on it. For instance, the following code let x = someExpression print x print x could print different values for x the two times you print it. (This is somewhat unlikely, but could happen when evaluating in parallel with ghc, because there is a small window where two threads might start evaluating x and later update x with two different values.)
-- Lennart