Safe Haskell | Safe-Inferred |
---|
- module Control.Exception
- catchIO :: IO a -> (IOException -> IO a) -> IO a
- handleIO :: (IOException -> IO a) -> IO a -> IO a
- tryIO :: IO a -> IO (Either IOException a)
- class Monad m => ExceptionMonad m where
- gtry :: (ExceptionMonad m, Exception e) => m a -> m (Either e a)
- ghandle :: (ExceptionMonad m, Exception e) => (e -> m a) -> m a -> m a
- gonException :: ExceptionMonad m => m a -> m b -> m a
Documentation
module Control.Exception
class Monad m => ExceptionMonad m whereSource
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 block
and
unblock
respectively. These are used for
implementations that support asynchronous exceptions. The default
implementations of gbracket
and gfinally
use gblock
and gunblock
thus rarely require overriding.
gcatch :: Exception e => m a -> (e -> m a) -> m aSource
gmask :: ((m a -> m a) -> m b) -> m bSource
gbracket :: m a -> (a -> m b) -> (a -> m c) -> m cSource
ExceptionMonad IO | |
ExceptionMonad Ghc | |
(Monad (GhcT m), ExceptionMonad m) => ExceptionMonad (GhcT m) |
gtry :: (ExceptionMonad m, Exception e) => m a -> m (Either e a)Source
ghandle :: (ExceptionMonad m, Exception e) => (e -> m a) -> m a -> m aSource
gonException :: ExceptionMonad m => m a -> m b -> m aSource
Always executes the first argument. If this throws an exception the second argument is executed and the exception is raised again.