• Thomas Schilling's avatar
    Introduce an 'ExceptionMonad' class. · 4767e535
    Thomas Schilling authored
    This monad provides variants of 'catch', 'bracket', and 'finally', so
    exceptions can be handled in monads that wrap IO.  The latter two
    methods need to be part of the class definition, because GHC uses
    'block' and 'unblock' which are used in the definition of those two
    methods for the IO monad.  A perhaps better class interface would
    consist of 'gcatch', 'gblock', and 'gunblock' and let the latter two
    default to 'id' like is done for non-GHC implementations of 'bracket'
    and 'finally'.
Exception.hs 3.39 KB