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

HaskellWorks.Polysemy.Except

Description

monad via MonadCatch.

Synopsis

Effect

data Except m a where Source #

An effect capable of providing catch and throwM semantics. Interpreters for this will successfully run the catch the exceptions thrown in the IO monad.

Constructors

CatchEx :: Exception e => m a -> (e -> m a) -> Except m a 
ThrowEx :: Exception e => e -> Except m a 

Actions

catchEx :: forall r e a. (Member Except r, Exception e) => Sem r a -> (e -> Sem r a) -> Sem r a Source #

throwEx :: forall r e a. (Member Except r, Exception e) => e -> Sem r a Source #

Interpretations

catchExToFinal :: forall a r m. MonadCatch m => MonadThrow m => Member (Final m) r => Sem (Except ': r) a -> Sem r a Source #

Run a Except effect in terms of catch and throwM through final monad.

Beware: Effects that aren't interpreted in terms of IO will have local state semantics in regards to Except effects interpreted this way. See Final.

catchExToFinalIO :: forall a r. Member (Final IO) r => Sem (Except ': r) a -> Sem r a Source #

Run a Except effect in terms of catch and throwM through final IO monad.