polysemy-1.6.0.0: Higher-order, low-boilerplate free monads.
Safe HaskellNone
LanguageHaskell2010

Polysemy.Fail

Synopsis

Effect

newtype Fail m a Source #

Constructors

Fail String 

Interpretations

runFail :: Sem (Fail ': r) a -> Sem r (Either String a) Source #

Run a Fail effect purely.

failToError :: Member (Error e) r => (String -> e) -> Sem (Fail ': r) a -> Sem r a Source #

Transform a Fail effect into an Error e effect, through providing a function for transforming any failure to an exception.

failToNonDet :: Member NonDet r => Sem (Fail ': r) a -> Sem r a Source #

Transform a Fail effect into a NonDet effect, through mapping any failure to empty.

failToEmbed :: forall m r a. (Member (Embed m) r, MonadFail m) => Sem (Fail ': r) a -> Sem r a Source #

Run a Fail effect in terms of an underlying MonadFail instance.