eff-0.0.0.0
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Writer.Strict

Synopsis

Documentation

runWriter :: Monoid w => Eff (Writer w ': effs) a -> Eff effs (w, a) Source #

Handles a Writer effect, strictly accumulating the monoidal state.

Note that the state will be accumulated via left-associated uses of <>. This is necessary to be strict, but it can be catastrophically slow on certain monoids, most notably []. To avoid pathological performance, use a data structure that supports efficient appends, such as Data.Sequence.Seq, or use Dual to flip the argument order of <> (but beware that this will cause the elements to be accumulated in reverse order).

evalWriter :: Monoid w => Eff (Writer w ': effs) a -> Eff effs a Source #

execWriter :: Monoid w => Eff (Writer w ': effs) a -> Eff effs w Source #