hw-polysemy-0.3.1.1: Opinionated polysemy library
Safe HaskellSafe-Inferred
LanguageHaskell2010

HaskellWorks.Polysemy.Error

Synopsis

Documentation

trap :: forall e a r. (e -> Sem r a) -> Sem (Error e ': r) a -> Sem r a Source #

Run a computation that may fail, and handle the error case. Unlike catch from Error this function removes the Error effect from the stack.

trap_ :: forall e a r. Sem r a -> Sem (Error e ': r) a -> Sem r a Source #

Like trap, but the error is not passed to the handler.

runErrorMap :: (e -> d) -> Sem (Error e : r) a -> Sem r (Either d a) Source #

Run an Error effect and map the error value to a different type.

embedRunExceptT :: forall e a r m. Member (Embed m) r => ExceptT e m a -> Sem r (Either e a) Source #

embedThrowExceptT :: forall e a r m. Member (Error e) r => Member (Embed m) r => ExceptT e m a -> Sem r a Source #

Run an embedded ExceptT effect in a Sem monad and throw any errors.