| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Exception
- 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 MonadIO 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
catchIO :: IO a -> (IOException -> IO a) -> IO a
handleIO :: (IOException -> IO a) -> IO a -> IO a
tryIO :: IO a -> IO (Either IOException a)
class MonadIO m => ExceptionMonad m where
A monad that can catch exceptions. A minimal definition
requires a definition of gcatch.
Implementations on top of IO should implement gmask to
eventually call the primitive mask.
These are used for
implementations that support asynchronous exceptions. The default
implementations of gbracket and gfinally use gmask
thus rarely require overriding.
Methods
gcatch :: Exception e => m a -> (e -> m a) -> m a
gmask :: ((m a -> m a) -> m b) -> m b
gbracket :: m a -> (a -> m b) -> (a -> m c) -> m c
gfinally :: m a -> m b -> m a
Instances
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
Always executes the first argument. If this throws an exception the second argument is executed and the exception is raised again.