| Copyright | (c) Riley Evans 2020 |
|---|---|
| License | BSD 3-Clause |
| Maintainer | haskell@rly.rocks |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Pipeline.Error
Description
This package contains the tools needed to throw errors inside a Task.
Errors will be propagated through the network.
Synopsis
- newtype TaskError = TaskError ExceptionMessage
- newtype ExceptionMessage = ExceptionMessage {}
- data ExceptT e (m :: Type -> Type) a
- data SomeException
- throwE :: forall (m :: Type -> Type) e a. Monad m => e -> ExceptT e m a
- throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a
- throwIO :: Exception e => e -> IO a
Documentation
Standard type of an error that is propagated through the network.
Constructors
| TaskError ExceptionMessage |
newtype ExceptionMessage #
A wrapper for an error message
Constructors
| ExceptionMessage | |
Fields | |
Instances
| Eq ExceptionMessage # | |
Defined in Pipeline.Internal.Core.Error Methods (==) :: ExceptionMessage -> ExceptionMessage -> Bool # (/=) :: ExceptionMessage -> ExceptionMessage -> Bool # | |
| Show ExceptionMessage # | |
Defined in Pipeline.Internal.Core.Error Methods showsPrec :: Int -> ExceptionMessage -> ShowS # show :: ExceptionMessage -> String # showList :: [ExceptionMessage] -> ShowS # | |
data ExceptT e (m :: Type -> Type) a #
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
| MonadBaseControl b m => MonadBaseControl b (ExceptT e m) | |
Defined in Control.Monad.Trans.Control Associated Types type StM (ExceptT e m) a | |
| MonadTrans (ExceptT e) | |
Defined in Control.Monad.Trans.Except | |
| MonadTransControl (ExceptT e) | |
| Monad m => Monad (ExceptT e m) | |
| Functor m => Functor (ExceptT e m) | |
| MonadFix m => MonadFix (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| MonadFail m => MonadFail (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| (Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| Foldable f => Foldable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except Methods fold :: Monoid m => ExceptT e f m -> m # foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldr1 :: (a -> a -> a) -> ExceptT e f a -> a # foldl1 :: (a -> a -> a) -> ExceptT e f a -> a # toList :: ExceptT e f a -> [a] # null :: ExceptT e f a -> Bool # length :: ExceptT e f a -> Int # elem :: Eq a => a -> ExceptT e f a -> Bool # maximum :: Ord a => ExceptT e f a -> a # minimum :: Ord a => ExceptT e f a -> a # | |
| Traversable f => Traversable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except | |
| Contravariant m => Contravariant (ExceptT e m) | |
| (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) # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e m a] # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e m a) # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e m a] # | |
| (Show e, Show1 m) => Show1 (ExceptT e m) | |
| MonadZip m => MonadZip (ExceptT e m) | |
| MonadIO m => MonadIO (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| (Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) | |
| (Monad m, Monoid e) => MonadPlus (ExceptT e m) | |
| PrimMonad m => PrimMonad (ExceptT e m) | |
| (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 # (<) :: ExceptT e m a -> ExceptT e m a -> Bool # (<=) :: ExceptT e m a -> ExceptT e m a -> Bool # (>) :: ExceptT e m a -> ExceptT e m a -> Bool # (>=) :: ExceptT e m a -> ExceptT e m a -> Bool # | |
| (Read e, Read1 m, Read a) => Read (ExceptT e m a) | |
| (Show e, Show1 m, Show a) => Show (ExceptT e m a) | |
| 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 | |
data SomeException #
The SomeException type is the root of the exception type hierarchy.
When an exception of type e is thrown, behind the scenes it is
encapsulated in a SomeException.
Instances
| Show SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS # show :: SomeException -> String # showList :: [SomeException] -> ShowS # | |
| Exception SomeException | Since: base-3.0 |
Defined in GHC.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # | |
throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a #
Throw an exception. Exceptions may be thrown from purely
functional code, but may only be caught within the IO monad.
throwIO :: Exception e => e -> IO a #
A variant of throw that can only be used within the IO monad.
Although throwIO has a type that is an instance of the type of throw, the
two functions are subtly different:
throw e `seq` x ===> throw e throwIO e `seq` x ===> x
The first example will cause the exception e to be raised,
whereas the second one won't. In fact, throwIO will only cause
an exception to be raised when it is used within the IO monad.
The throwIO variant should be used in preference to throw to
raise an exception within the IO monad because it guarantees
ordering with respect to other IO operations, whereas throw
does not.