mongoDB-0.7.1: A driver for MongoDB



This is just like Control.Monad.Error.Class except you can throw/catch the error of any ErrorT in the monad stack instead of just the top one as long as the error types are different. If two or more ErrorTs in the stack have the same error type you get the error of the top one.



class Monad m => Throw e m whereSource

Same as MonadError but without functional dependency so the same monad can have multiple errors with different types


throw :: e -> m aSource

Abort action and throw give exception. Analogous to throwError.

catch :: m a -> (e -> m a) -> m aSource

If first action aborts with exception then execute second action. Analogous to catchError


Error e => Throw e (Either e) 
Throw IOError m => Throw IOError (Connected m) 
Monad m => Throw Failure (Connected m) 
Throw e m => Throw e (ReaderT x m) 
(Error e, Throw e m, Error x) => Throw e (ErrorT x m) 
(Error e, Monad m) => Throw e (ErrorT e m) 

throwLeft :: Throw e m => m (Either e a) -> m aSource

Execute action and throw exception if result is Left, otherwise return the Right result