polysemy-zoo-0.8.1.0: Experimental, user-contributed effects and interpreters for polysemy
Safe HaskellNone
LanguageHaskell2010

Polysemy.Final.MTL

Synopsis

Documentation

errorToFinal :: forall m e r a. (Member (Final m) r, MonadError e m) => Sem (Error e ': r) a -> Sem r a Source #

Run an Error effect through a final MonadError

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

readerToFinal :: forall m i r a. (Member (Final m) r, MonadReader i m) => Sem (Reader i ': r) a -> Sem r a Source #

Run a Reader effect through a final MonadReader

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

stateToEmbed :: forall m s r a. (Member (Embed m) r, MonadState s m) => Sem (State s ': r) a -> Sem r a Source #

Run a State effect in terms of an underlying MonadState instance

Although this is not a Final interpreter, as the target monad need not actually be the final monad, stateToEmbed still possesses the unusual semantics of interpreters that runs effects by embedding them into another monad.

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

writerToFinal :: forall m o r a. (Member (Final m) r, MonadWriter o m) => Sem (Writer o ': r) a -> Sem r a Source #

Run a Writer effect through a final MonadWriter

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