Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Error e m a where
- throw :: forall e r a. MemberWithError (Error e) r => e -> Sem r a
- catch :: forall e r a. MemberWithError (Error e) r => Sem r a -> (e -> Sem r a) -> Sem r a
- fromEither :: Member (Error e) r => Either e a -> Sem r a
- fromEitherM :: forall e m r a. (Member (Error e) r, Member (Embed m) r) => m (Either e a) -> Sem r a
- runError :: Sem (Error e ': r) a -> Sem r (Either e a)
- mapError :: forall e1 e2 r a. Member (Error e2) r => (e1 -> e2) -> Sem (Error e1 ': r) a -> Sem r a
- errorToIOFinal :: (Typeable e, Member (Final IO) r) => Sem (Error e ': r) a -> Sem r (Either e a)
- lowerError :: (Typeable e, Member (Embed IO) r) => (forall x. Sem r x -> IO x) -> Sem (Error e ': r) a -> Sem r (Either e a)
Effect
data Error e m a where Source #
Instances
type DefiningModule (Error :: Type -> (k -> Type) -> k -> Type) Source # | |
Defined in Polysemy.Error |
Actions
fromEitherM :: forall e m r a. (Member (Error e) r, Member (Embed m) r) => m (Either e a) -> Sem r a Source #
A combinator doing embed
and fromEither
at the same time. Useful for
interoperating with IO
.
Since: 0.5.1.0
Interpretations
mapError :: forall e1 e2 r a. Member (Error e2) r => (e1 -> e2) -> Sem (Error e1 ': r) a -> Sem r a Source #
Transform one Error
into another. This function can be used to aggregate
multiple errors into a single type.
Since: 1.0.0.0
errorToIOFinal :: (Typeable e, Member (Final IO) r) => Sem (Error e ': r) a -> Sem r (Either e a) Source #
:: (Typeable e, Member (Embed IO) r) | |
=> (forall x. Sem r x -> IO x) | Strategy for lowering a |
-> Sem (Error e ': r) a | |
-> Sem r (Either e a) |
Deprecated: Use errorToIOFinal
instead
Run an Error
effect as an IO
Exception
. This interpretation is
significantly faster than runError
, at the cost of being less flexible.
Since: 1.0.0.0