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

Polysemy.Internal.Writer

Synopsis

Documentation

data Writer o m a where Source #

An effect capable of emitting and intercepting messages.

Constructors

Tell :: o -> Writer o m () 
Listen :: forall o m a. m a -> Writer o m (o, a) 
Pass :: m (o -> o, a) -> Writer o m a 

Instances

Instances details
type DefiningModule Writer Source # 
Instance details

Defined in Polysemy.Internal.Writer

type DefiningModule Writer = "Polysemy.Internal.Writer"

pass :: forall o r a. MemberWithError (Writer o) r => Sem r (o -> o, a) -> Sem r a Source #

listen :: forall o r a. MemberWithError (Writer o) r => Sem r a -> Sem r (o, a) Source #

tell :: forall o r. MemberWithError (Writer o) r => o -> Sem r () Source #

writerToEndoWriter :: (Monoid o, Member (Writer (Endo o)) r) => Sem (Writer o ': r) a -> Sem r a Source #

Transform a Writer o effect into a Writer (Endo o) effect, right-associating all uses of <> for o.

This can be used together with raiseUnder in order to create -AssocR variants out of regular Writer interpreters.

Since: 1.2.0.0

runWriterSTMAction :: forall o r a. (Member (Final IO) r, Monoid o) => (o -> STM ()) -> Sem (Writer o ': r) a -> Sem r a Source #

A variant of runWriterTVar where an STM action is used instead of a TVar to commit tells.

interpretViaLazyWriter :: forall o e r a. Monoid o => (forall m x. Monad m => Weaving e (WriterT o m) x -> WriterT o m x) -> Sem (e ': r) a -> Sem r (o, a) Source #