hscurses-1.4.1.2: NCurses bindings for Haskell

Safe Haskell | None

UI.HSCurses.MonadException

# Documentation

class Monad m => MonadExc m where Source

Methods

catchM :: Exception e => m a -> (e -> m a) -> m aSource

blockM :: m a -> m aSource

unblockM :: m a -> m aSource

Instances

MonadExc IO |
MonadExc m => MonadExc (StateT s m) |

class (MonadIO m, MonadExc m) => MonadExcIO m Source

Instances

MonadExcIO IO |
(MonadExc m, MonadIO m) => MonadExcIO (StateT s m) |

catchJustM Source

Arguments

:: (Exception e, MonadExc m) |
=> (e -> Maybe b) | Predicate to select exceptions
-> m a | Computation to run
-> (b -> m a) | Handler
-> m a |

handleM :: (Exception e, MonadExc m) => (e -> m a) -> m a -> m aSource

handleJustM :: (Exception e, MonadExc m) => (e -> Maybe b) -> (b -> m a) -> m a -> m aSource

tryM :: (Exception e, MonadExc m) => m a -> m (Either e a)Source

tryJustM :: (Exception e, MonadExc m) => (e -> Maybe b) -> m a -> m (Either b a)Source

bracketM Source

Arguments

:: MonadExc m |
=> m a | computation to run first ("acquire resource")
-> (a -> m b) | computation to run last ("release resource")
-> (a -> m c) | computation to run in-between
-> m c |

bracketM_ :: MonadExc m => m a -> m b -> m c -> m cSource

finally Source

Arguments

:: IO a | computation to run first
-> IO b | computation to run afterward (even if an exception was raised)
-> IO a |

modifyState :: MonadExc m => (s -> m (a, s)) -> StateT s m aSource

catchState :: (Exception e, MonadExc m) => StateT s m a -> (e -> StateT s m a) -> StateT s m aSource

blockState :: MonadExc m => StateT s m a -> StateT s m aSource

unblockState :: MonadExc m => StateT s m a -> StateT s m aSource