| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This module provides support for raising and catching both built-in and user-defined exceptions in user defined monads. It is adapted from Control.Exception and extends the code supplied by oleg at pobox.com on the Haskell mailing list to lift all functions in Control.Exception to all monads formed by applying common monad transformers to monads based on IO. Refs: http://www.haskell.org/pipermail/haskell/2006-February/017547.html To use this you should hide all the conflicting Prelude functions or disable implicit Prelude and use a minimal Prelude as suggested in http://hackage.haskell.org/trac/haskell-prime/wiki/Prelude THIS MODULE HAS NOT BEEN FULLY TESTED AND IS JUST PROVIDED AS AN EXAMPLE FOR DISCUSSION. In particular, you should read Oleg's comments above regarding semantics of the different monads under exceptions, and if in doubt, consider ReaderT instead of StateT. If you find any bugs in this module, please send an email to brianh at metamilk.com | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class MonadIO m => MonadException m where | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Exception | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IOException | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ArithException | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ArrayException | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AsyncException | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapException | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ioErrors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arithExceptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errorCalls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dynExceptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asyncExceptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| userErrors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ioError :: MonadIO m => IOError -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| evaluate :: MonadIO m => a -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getUncaughtExceptionHandler :: MonadIO m => m (Exception -> m ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throwDyn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throwM :: MonadIO m => Exception -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throwTo :: MonadIO m => ThreadId -> Exception -> m () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throwDynTo :: (MonadIO m, Typeable exception) => ThreadId -> exception -> m () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle :: MonadException m => (Exception -> m a) -> m a -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handleDyn :: (Typeable exception, MonadException m) => (exception -> m a) -> m a -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handleJust :: MonadException m => (Exception -> Maybe b) -> (b -> m a) -> m a -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| catchDyn :: (Typeable exception, MonadException m) => m a -> (exception -> m a) -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| catchJust :: MonadException m => (Exception -> Maybe b) -> m a -> (b -> m a) -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try :: MonadException m => m a -> m (Either Exception a) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tryJust :: MonadException m => (Exception -> Maybe b) -> m a -> m (Either b a) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bracket :: MonadException m => m a -> (a -> m b) -> (a -> m c) -> m c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bracket_ :: MonadException m => m a -> m b -> m c -> m c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| finally :: MonadException m => m a -> m b -> m a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.8 |