Introduce an 'ExceptionMonad' class.
authorThomas Schilling <nominolo@googlemail.com>
Sun, 14 Sep 2008 17:21:54 +0000 (17:21 +0000)
committerThomas Schilling <nominolo@googlemail.com>
Sun, 14 Sep 2008 17:21:54 +0000 (17:21 +0000)
commit4767e535d9761920a18629a4142d3a929503b936
tree826e881ad134ae6d724737c2314466d5b293eab0
parent008e99819bdc12b2ebac66a99f7be2d5db16e5f9
Introduce an 'ExceptionMonad' class.

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'.
compiler/utils/Exception.hs