Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Excepts es m a = Excepts (m (VEither es a))
- runE :: forall es a m. Excepts es m a -> m (VEither es a)
- runE_ :: forall es a m. Functor m => Excepts es m a -> m ()
- liftE :: forall es' es a m. (Monad m, VEitherLift es es') => Excepts es m a -> Excepts es' m a
- appendE :: forall ns es a m. Monad m => Excepts es m a -> Excepts (Concat es ns) m a
- prependE :: forall ns es a m. (Monad m, KnownNat (Length ns)) => Excepts es m a -> Excepts (Concat ns es) m a
- failureE :: forall e a m. Monad m => e -> Excepts '[e] m a
- successE :: forall a m. Monad m => a -> Excepts '[] m a
- throwE :: forall e es a m. (Monad m, e :< es) => e -> Excepts es m a
- throwSomeE :: forall es' es a m. (Monad m, LiftVariant es' es) => V es' -> Excepts es m a
- catchE :: forall e es' es'' es a m. (Monad m, e :< es, LiftVariant (Remove e es) es', LiftVariant es'' es') => (e -> Excepts es'' m a) -> Excepts es m a -> Excepts es' m a
- catchEvalE :: Monad m => (V es -> m a) -> Excepts es m a -> m a
- evalE :: Monad m => Excepts '[] m a -> m a
- onE_ :: Monad m => m () -> Excepts es m a -> Excepts es m a
- onE :: Monad m => (V es -> m ()) -> Excepts es m a -> Excepts es m a
- finallyE :: Monad m => m () -> Excepts es m a -> Excepts es m a
- injectExcepts :: forall es a m. Monad m => Excepts es m a -> Excepts es m (VEither es a)
- withExcepts :: Monad m => (VEither es a -> m b) -> Excepts es m a -> Excepts es m b
- withExcepts_ :: Monad m => (VEither es a -> m ()) -> Excepts es m a -> Excepts es m a
- mapExcepts :: (m (VEither es a) -> n (VEither es' b)) -> Excepts es m a -> Excepts es' n b
- variantToExcepts :: Monad m => V (a ': es) -> Excepts es m a
- veitherToExcepts :: Monad m => VEither es a -> Excepts es m a
- catchLiftBoth :: forall e es' es'' es a m. (Monad m, e :< es, LiftVariant (Remove e es) es', LiftVariant es'' es') => (e -> Excepts es'' m a) -> Excepts es m a -> Excepts es' m a
- catchLiftLeft :: forall e es es' a m. (Monad m, e :< es, LiftVariant (Remove e es) es') => (e -> Excepts es' m a) -> Excepts es m a -> Excepts es' m a
- catchLiftRight :: forall e es es' a m. (Monad m, e :< es, LiftVariant es' (Remove e es)) => (e -> Excepts es' m a) -> Excepts es m a -> Excepts (Remove e es) m a
- catchAllE :: Monad m => (V es -> Excepts es' m a) -> Excepts es m a -> Excepts es' m a
- catchDieE :: (e :< es, Monad m) => (e -> m ()) -> Excepts es m a -> Excepts (Remove e es) m a
- catchRemove :: forall e es a m. Monad m => (e -> Excepts es m a) -> Excepts (e ': es) m a -> Excepts es m a
- sequenceE :: (KnownNat (Length (b : e2)), Monad m) => Excepts e1 m a -> Excepts e2 m b -> Excepts (Tail (Product (a : e1) (b : e2))) m (a, b)
- runBothE :: (KnownNat (Length (b : e2)), Monad m) => (forall x y. m x -> m y -> m (x, y)) -> Excepts e1 m a -> Excepts e2 m b -> Excepts (Tail (Product (a : e1) (b : e2))) m (a, b)
- module Haskus.Utils.Variant.VEither
Documentation
newtype Excepts es m a Source #
Instances
runE_ :: forall es a m. Functor m => Excepts es m a -> m () Source #
Run an Excepts, discard the result value
liftE :: forall es' es a m. (Monad m, VEitherLift es es') => Excepts es m a -> Excepts es' m a Source #
Lift a Excepts into another
appendE :: forall ns es a m. Monad m => Excepts es m a -> Excepts (Concat es ns) m a Source #
Append errors to an Excepts
prependE :: forall ns es a m. (Monad m, KnownNat (Length ns)) => Excepts es m a -> Excepts (Concat ns es) m a Source #
Prepend errors to an Excepts
throwE :: forall e es a m. (Monad m, e :< es) => e -> Excepts es m a Source #
Signal an exception value e
.
throwSomeE :: forall es' es a m. (Monad m, LiftVariant es' es) => V es' -> Excepts es m a Source #
Throw some exception
catchE :: forall e es' es'' es a m. (Monad m, e :< es, LiftVariant (Remove e es) es', LiftVariant es'' es') => (e -> Excepts es'' m a) -> Excepts es m a -> Excepts es' m a Source #
Handle an exception. Lift both normal and exceptional flows into the result flow
catchEvalE :: Monad m => (V es -> m a) -> Excepts es m a -> m a Source #
Evaluate a Excepts. Use the provided function to handle error cases.
onE :: Monad m => (V es -> m ()) -> Excepts es m a -> Excepts es m a Source #
Do something in case of error
variantToExcepts :: Monad m => V (a ': es) -> Excepts es m a Source #
Convert a Variant into a Excepts
veitherToExcepts :: Monad m => VEither es a -> Excepts es m a Source #
Convert a VEither into a Excepts
catchLiftBoth :: forall e es' es'' es a m. (Monad m, e :< es, LiftVariant (Remove e es) es', LiftVariant es'' es') => (e -> Excepts es'' m a) -> Excepts es m a -> Excepts es' m a Source #
Handle an exception. Lift both normal and exceptional flows into the result flow
catchLiftLeft :: forall e es es' a m. (Monad m, e :< es, LiftVariant (Remove e es) es') => (e -> Excepts es' m a) -> Excepts es m a -> Excepts es' m a Source #
Handle an exception. Lift the remaining errors into the resulting flow
catchLiftRight :: forall e es es' a m. (Monad m, e :< es, LiftVariant es' (Remove e es)) => (e -> Excepts es' m a) -> Excepts es m a -> Excepts (Remove e es) m a Source #
Handle an exception. Lift the handler into the resulting flow
catchAllE :: Monad m => (V es -> Excepts es' m a) -> Excepts es m a -> Excepts es' m a Source #
Do something in case of error
catchDieE :: (e :< es, Monad m) => (e -> m ()) -> Excepts es m a -> Excepts (Remove e es) m a Source #
Catch and die in case of error
catchRemove :: forall e es a m. Monad m => (e -> Excepts es m a) -> Excepts (e ': es) m a -> Excepts es m a Source #
Handle an exception. Assume it is in the first position
sequenceE :: (KnownNat (Length (b : e2)), Monad m) => Excepts e1 m a -> Excepts e2 m b -> Excepts (Tail (Product (a : e1) (b : e2))) m (a, b) Source #
Product of the sequential execution of two Excepts
The second one is run even if the first one failed!
runBothE :: (KnownNat (Length (b : e2)), Monad m) => (forall x y. m x -> m y -> m (x, y)) -> Excepts e1 m a -> Excepts e2 m b -> Excepts (Tail (Product (a : e1) (b : e2))) m (a, b) Source #
Product of the execution of two Excepts
You can use a generic monad combinator such as
concurrently
(in "async" package) to get
concurrent execution.
> concurrentE = runBothE concurrently
Reexport
module Haskus.Utils.Variant.VEither