| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Control.Error.Util
Description
This module exports miscellaneous error-handling functions.
Synopsis
- hush :: Either a b -> Maybe b
- hushT :: forall (m :: Type -> Type) a b. Monad m => ExceptT a m b -> MaybeT m b
- note :: a -> Maybe b -> Either a b
- noteT :: forall (m :: Type -> Type) a b. Monad m => a -> MaybeT m b -> ExceptT a m b
- hoistMaybe :: forall (m :: Type -> Type) b. Monad m => Maybe b -> MaybeT m b
- hoistEither :: forall (m :: Type -> Type) e a. Monad m => Either e a -> ExceptT e m a
- (??) :: forall (m :: Type -> Type) a e. Applicative m => Maybe a -> e -> ExceptT e m a
- (!?) :: Applicative m => m (Maybe a) -> e -> ExceptT e m a
- failWith :: forall (m :: Type -> Type) e a. Applicative m => e -> Maybe a -> ExceptT e m a
- failWithM :: Applicative m => e -> m (Maybe a) -> ExceptT e m a
- bool :: a -> a -> Bool -> a
- (?:) :: Maybe a -> a -> a
- maybeT :: Monad m => m b -> (a -> m b) -> MaybeT m a -> m b
- just :: forall (m :: Type -> Type) a. Monad m => a -> MaybeT m a
- nothing :: forall (m :: Type -> Type) a. Monad m => MaybeT m a
- isJustT :: Monad m => MaybeT m a -> m Bool
- isNothingT :: Monad m => MaybeT m a -> m Bool
- isLeft :: Either a b -> Bool
- isRight :: Either a b -> Bool
- fmapR :: (a -> b) -> Either l a -> Either l b
- newtype AllE e r = AllE {
- runAllE :: Either e r
- newtype AnyE e r = AnyE {
- runAnyE :: Either e r
- isLeftT :: Monad m => ExceptT a m b -> m Bool
- isRightT :: Monad m => ExceptT a m b -> m Bool
- fmapRT :: forall (m :: Type -> Type) a b l. Monad m => (a -> b) -> ExceptT l m a -> ExceptT l m b
- exceptT :: Monad m => (a -> m c) -> (b -> m c) -> ExceptT a m b -> m c
- bimapExceptT :: forall (m :: Type -> Type) e f a b. Functor m => (e -> f) -> (a -> b) -> ExceptT e m a -> ExceptT f m b
- err :: Text -> IO ()
- errLn :: Text -> IO ()
- tryIO :: forall (m :: Type -> Type) a. MonadIO m => IO a -> ExceptT IOException m a
- handleExceptT :: (Exception e, Functor m, MonadCatch m) => (e -> x) -> m a -> ExceptT x m a
- syncIO :: forall (m :: Type -> Type) a. MonadIO m => IO a -> ExceptT SomeException m a
Conversion
hushT :: forall (m :: Type -> Type) a b. Monad m => ExceptT a m b -> MaybeT m b Source #
Suppress the Left value of an ExceptT
noteT :: forall (m :: Type -> Type) a b. Monad m => a -> MaybeT m b -> ExceptT a m b Source #
Tag the Nothing value of a MaybeT
hoistMaybe :: forall (m :: Type -> Type) b. Monad m => Maybe b -> MaybeT m b Source #
Lift a Maybe to the MaybeT monad
hoistEither :: forall (m :: Type -> Type) e a. Monad m => Either e a -> ExceptT e m a Source #
Upgrade an Either to an ExceptT
(??) :: forall (m :: Type -> Type) a e. Applicative m => Maybe a -> e -> ExceptT e m a Source #
Convert a Maybe value into the ExceptT monad
(!?) :: Applicative m => m (Maybe a) -> e -> ExceptT e m a Source #
Convert an applicative Maybe value into the ExceptT monad
Bool
bool :: a -> a -> Bool -> a Source #
Case analysis for the Bool type.
bool a b c == if c then b else a
Maybe
MaybeT
just :: forall (m :: Type -> Type) a. Monad m => a -> MaybeT m a Source #
Analogous to Just and equivalent to return
nothing :: forall (m :: Type -> Type) a. Monad m => MaybeT m a Source #
Analogous to Nothing and equivalent to mzero
Either
fmapR :: (a -> b) -> Either l a -> Either l b Source #
fmap specialized to Either, given a name symmetric to
fmapL
Run multiple Either computations and succeed if all of them succeed
mappends all successes or failures
Run multiple Either computations and succeed if any of them succeed
mappends all successes or failures
ExceptT
fmapRT :: forall (m :: Type -> Type) a b l. Monad m => (a -> b) -> ExceptT l m a -> ExceptT l m b Source #
exceptT :: Monad m => (a -> m c) -> (b -> m c) -> ExceptT a m b -> m c Source #
Fold an ExceptT by providing one continuation for each constructor
bimapExceptT :: forall (m :: Type -> Type) e f a b. Functor m => (e -> f) -> (a -> b) -> ExceptT e m a -> ExceptT f m b Source #
Transform the left and right value
Error Reporting
Exceptions
tryIO :: forall (m :: Type -> Type) a. MonadIO m => IO a -> ExceptT IOException m a Source #
Catch IOExceptions and convert them to the ExceptT monad
handleExceptT :: (Exception e, Functor m, MonadCatch m) => (e -> x) -> m a -> ExceptT x m a Source #
Run a monad action which may throw an exception in the ExceptT monad