summaryrefslogtreecommitdiff
path: root/compiler/utils/Exception.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/Exception.hs')
-rw-r--r--compiler/utils/Exception.hs24
1 files changed, 4 insertions, 20 deletions
diff --git a/compiler/utils/Exception.hs b/compiler/utils/Exception.hs
index b4908997a8..850393e359 100644
--- a/compiler/utils/Exception.hs
+++ b/compiler/utils/Exception.hs
@@ -21,11 +21,11 @@ tryIO = try
-- | A monad that can catch exceptions. A minimal definition
-- requires a definition of 'gcatch'.
--
--- Implementations on top of 'IO' should implement 'gblock' and 'gunblock' to
--- eventually call the primitives 'Control.Exception.block' and
--- 'Control.Exception.unblock' respectively. These are used for
+-- Implementations on top of 'IO' should implement 'gmask' to
+-- eventually call the primitive 'Control.Exception.mask'.
+-- These are used for
-- implementations that support asynchronous exceptions. The default
--- implementations of 'gbracket' and 'gfinally' use 'gblock' and 'gunblock'
+-- implementations of 'gbracket' and 'gfinally' use 'gmask'
-- thus rarely require overriding.
--
class MonadIO m => ExceptionMonad m where
@@ -46,20 +46,6 @@ class MonadIO m => ExceptionMonad m where
-- exception handling monad instead of just 'IO'.
gfinally :: m a -> m b -> m a
- -- | DEPRECATED, here for backwards compatibilty. Instances can
- -- define either 'gmask', or both 'block' and 'unblock'.
- gblock :: m a -> m a
- -- | DEPRECATED, here for backwards compatibilty Instances can
- -- define either 'gmask', or both 'block' and 'unblock'.
- gunblock :: m a -> m a
- -- XXX we're keeping these two methods for the time being because we
- -- have to interact with Haskeline's MonadException class which
- -- still has block/unblock; see GhciMonad.hs.
-
- gmask f = gblock (f gunblock)
- gblock f = gmask (\_ -> f)
- gunblock f = f -- XXX wrong; better override this if you need it
-
gbracket before after thing =
gmask $ \restore -> do
a <- before
@@ -76,8 +62,6 @@ class MonadIO m => ExceptionMonad m where
instance ExceptionMonad IO where
gcatch = Control.Exception.catch
gmask f = mask (\x -> f x)
- gblock = block
- gunblock = unblock
gtry :: (ExceptionMonad m, Exception e) => m a -> m (Either e a)
gtry act = gcatch (act >>= \a -> return (Right a))