Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Network.Gitit.Compat.Except
Synopsis
- data ExceptT e (m :: Type -> Type) a
- type Except e = ExceptT e Identity
- class Error a where
- runExceptT :: ExceptT e m a -> m (Either e a)
- runExcept :: Except e a -> Either e a
- class Monad m => MonadError e (m :: Type -> Type) | m -> e
- throwError :: MonadError e m => e -> m a
- catchError :: MonadError e m => m a -> (e -> m a) -> m a
Documentation
data ExceptT e (m :: Type -> Type) a Source #
A monad transformer that adds exceptions to other monads.
ExceptT
constructs a monad parameterized over two things:
- e - The exception type.
- m - The inner monad.
The return
function yields a computation that produces the given
value, while >>=
sequences two subcomputations, exiting on the
first exception.
Instances
FilterMonad a m => FilterMonad a (ExceptT e m) | |
WebMonad a m => WebMonad a (ExceptT e m) | |
Defined in Happstack.Server.Internal.Monads Methods finishWith :: a -> ExceptT e m b Source # | |
MonadBaseControl b m => MonadBaseControl b (ExceptT e m) | |
Defined in Control.Monad.Trans.Control Associated Types type StM (ExceptT e m) a | |
Monad m => MonadError e (ExceptT e m) | Since: mtl-2.2 |
Defined in Control.Monad.Error.Class Methods throwError :: e -> ExceptT e m a Source # catchError :: ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a Source # | |
MonadReader r m => MonadReader r (ExceptT e m) | Since: mtl-2.2 |
MonadState s m => MonadState s (ExceptT e m) | Since: mtl-2.2 |
MonadTransControl (ExceptT e) | |
MonadTrans (ExceptT e) | |
MonadFail m => MonadFail (ExceptT e m) | |
MonadFix m => MonadFix (ExceptT e m) | |
MonadIO m => MonadIO (ExceptT e m) | |
MonadZip m => MonadZip (ExceptT e m) | |
Foldable f => Foldable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except Methods fold :: Monoid m => ExceptT e f m -> m Source # foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m Source # foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m Source # foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b Source # foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b Source # foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b Source # foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b Source # foldr1 :: (a -> a -> a) -> ExceptT e f a -> a Source # foldl1 :: (a -> a -> a) -> ExceptT e f a -> a Source # toList :: ExceptT e f a -> [a] Source # null :: ExceptT e f a -> Bool Source # length :: ExceptT e f a -> Int Source # elem :: Eq a => a -> ExceptT e f a -> Bool Source # maximum :: Ord a => ExceptT e f a -> a Source # minimum :: Ord a => ExceptT e f a -> a Source # | |
(Eq e, Eq1 m) => Eq1 (ExceptT e m) | |
(Ord e, Ord1 m) => Ord1 (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
(Read e, Read1 m) => Read1 (ExceptT e m) | |
Defined in Control.Monad.Trans.Except Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ExceptT e m a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e m a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e m a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e m a] Source # | |
(Show e, Show1 m) => Show1 (ExceptT e m) | |
Contravariant m => Contravariant (ExceptT e m) | |
Traversable f => Traversable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except Methods traverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) Source # sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) Source # mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) Source # sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) Source # | |
(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) | |
(Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except Methods pure :: a -> ExceptT e m a Source # (<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b Source # liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c Source # (*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b Source # (<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a Source # | |
Functor m => Functor (ExceptT e m) | |
Monad m => Monad (ExceptT e m) | |
(Monad m, Monoid e) => MonadPlus (ExceptT e m) | |
MonadCatch m => MonadCatch (ExceptT e m) | Catches exceptions from the base monad. |
MonadMask m => MonadMask (ExceptT e m) | Since: exceptions-0.9.0 |
Defined in Control.Monad.Catch Methods mask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b Source # uninterruptibleMask :: ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b Source # generalBracket :: ExceptT e m a -> (a -> ExitCase b -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m (b, c) Source # | |
MonadThrow m => MonadThrow (ExceptT e m) | Throws exceptions into the base monad. |
(Monad m, HasDynFlags m) => HasDynFlags (ExceptT e m) | |
Defined in GHC.Driver.Session Methods getDynFlags :: ExceptT e m DynFlags Source # | |
ServerMonad m => ServerMonad (ExceptT e m) | |
(Happstack m, Monoid e) => Happstack (ExceptT e m) | |
Defined in Happstack.Server.Monads | |
(Monad m, HasRqData m) => HasRqData (ExceptT e m) | |
PrimMonad m => PrimMonad (ExceptT e m) | |
MonadResource m => MonadResource (ExceptT e m) | |
Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ExceptT e m a | |
(Read e, Read1 m, Read a) => Read (ExceptT e m a) | |
(Show e, Show1 m, Show a) => Show (ExceptT e m a) | |
(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |
(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) | |
Defined in Control.Monad.Trans.Except Methods compare :: ExceptT e m a -> ExceptT e m a -> Ordering Source # (<) :: ExceptT e m a -> ExceptT e m a -> Bool Source # (<=) :: ExceptT e m a -> ExceptT e m a -> Bool Source # (>) :: ExceptT e m a -> ExceptT e m a -> Bool Source # (>=) :: ExceptT e m a -> ExceptT e m a -> Bool Source # max :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a Source # min :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a Source # | |
type StT (ExceptT e) a | |
Defined in Control.Monad.Trans.Control | |
type PrimState (ExceptT e m) | |
Defined in Control.Monad.Primitive type PrimState (ExceptT e m) = PrimState m | |
type StM (ExceptT e m) a | |
Defined in Control.Monad.Trans.Control |
Minimal complete definition
Nothing
runExcept :: Except e a -> Either e a Source #
Extractor for computations in the exception monad.
(The inverse of except
).
class Monad m => MonadError e (m :: Type -> Type) | m -> e Source #
The strategy of combining computations that can throw exceptions by bypassing bound functions from the point an exception is thrown to the point that it is handled.
Is parameterized over the type of error information and
the monad type constructor.
It is common to use
as the monad type constructor
for an error monad in which error descriptions take the form of strings.
In that case and many other common cases the resulting monad is already defined
as an instance of the Either
StringMonadError
class.
You can also define your own error type and/or use a monad type constructor
other than
or Either
String
.
In these cases you will have to explicitly define instances of the Either
IOError
MonadError
class.
(If you are using the deprecated Control.Monad.Error or
Control.Monad.Trans.Error, you may also have to define an Error
instance.)
Minimal complete definition
Instances
throwError :: MonadError e m => e -> m a Source #
Is used within a monadic computation to begin exception processing.
catchError :: MonadError e m => m a -> (e -> m a) -> m a Source #
A handler function to handle previous errors and return to normal execution. A common idiom is:
do { action1; action2; action3 } `catchError` handler
where the action
functions can call throwError
.
Note that handler
and the do-block must have the same return type.