A class for monads which allow exceptions to be caught, in particular
exceptions which were thrown by
throwM.
Instances should obey the following law:
catch (throwM e) f = f e
Note that the ability to catch an exception does
not guarantee
that we can deal with all possible exit points from a computation.
Some monads, such as continuation-based stacks, allow for more than
just a success/failure strategy, and therefore
catch
cannot be used by those monads to properly implement a function
such as
finally. For more information, see
MonadMask.