
On Sat, 22 Nov 2008, Thomas Schilling wrote:
It's a pattern match error, implemented by throwing an asynchronous exception. The idea being, that we only have one mechanism (well, an synchronous exceptions, thrown via throwIO).
Yes, I know that there's a difference between "error" and "exception", but I would argue that which is which depends on the program. For example, for most programs a pattern match error is a fatal condition, there's no sane recovery from it. OTOH, in a program like GHCi, a pattern match error in an executed statement is an exceptional condition, which we want to catch, so it doesn't kill GHCi.
It's completely ok to run something in a sandbox and try to observe errors. But that's debugging and I think there is no need to do this in many places of an application. In general handling errors automatically is not possible, because an error might also be if a program loops infinitely. Thus one should not generally handle an error like an exception.