Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type EffectWriter w es = (Monoid w, Member (Writer w) es, w ~ WriterType es)
- data Writer w a
- runWriter :: Monoid w => Effect (Writer w : es) a -> Effect es (a, w)
- tell :: EffectWriter w es => w -> Effect es ()
- listen :: EffectWriter w es => Effect es a -> Effect es (a, w)
- listens :: EffectWriter w es => (w -> b) -> Effect es a -> Effect es (a, b)
- pass :: EffectWriter w es => Effect es (a, w -> w) -> Effect es a
- censor :: EffectWriter w es => (w -> w) -> Effect es a -> Effect es a
Documentation
type EffectWriter w es = (Monoid w, Member (Writer w) es, w ~ WriterType es) Source
tell :: EffectWriter w es => w -> Effect es () Source
Writes a value to the output.
listen :: EffectWriter w es => Effect es a -> Effect es (a, w) Source
Executes a computation, and obtains the writer output. The writer output of the inner computation is still written to the writer output of the outer computation.
listens :: EffectWriter w es => (w -> b) -> Effect es a -> Effect es (a, b) Source
Like listen
, but the writer output is run through a function.
pass :: EffectWriter w es => Effect es (a, w -> w) -> Effect es a Source
Runs a computation that returns a value and a function, applies the function to the writer output, and then returns the value.
censor :: EffectWriter w es => (w -> w) -> Effect es a -> Effect es a Source
Applies a function to the writer output of a computation.