polysemy-0.1.2.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 -> Sem r () Source #

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

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

Interpretations

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

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

Interpretations for Other Effects

runOutputAsWriter :: Member (Writer o) r => Sem (Output o ': r) a -> Sem r a Source #

Transform an Output effect into a Writer effect.