polysemy-0.1.1.0: Higher-order, low-boilerplate, zero-cost free monads.

Safe HaskellNone
LanguageHaskell2010

Polysemy.Writer

Contents

Synopsis

Effect

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) 
Censor :: (o -> o) -> m a -> Writer o m a 
Instances
type DefiningModule Writer Source # 
Instance details

Defined in Polysemy.Writer

type DefiningModule Writer = "Polysemy.Writer"

Actions

tell :: forall o. forall r. Member (Writer o) r => o -> Semantic r () Source #

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

censor :: forall o a. forall r. Member (Writer o) r => (o -> o) -> Semantic r a -> Semantic r a Source #

Interpretations

runOutputAsWriter :: Semantic (Output o ': r) a -> Semantic (Writer o ': r) a Source #

Transform an Output effect into a Writer effect.

runWriter :: (Monoid o, Typeable o) => Semantic (Writer o ': r) a -> Semantic r (o, a) Source #

Run a Writer effect in the style of WriterT (but without the nasty space leak!)