extensible-effects-1.5.0: An Alternative to Monad Transformers

Safe HaskellTrustworthy

Control.Eff.Writer.Lazy

Description

Lazy write-only state.

Synopsis

Documentation

data Writer w v Source

The request to remember a value of type w in the current environment

Instances

tell :: (Typeable w, Member (Writer w) r) => w -> Eff r ()Source

Write a new value.

censor :: (Typeable w, Member (Writer w) r) => (w -> w) -> Eff r a -> Eff r aSource

Transform the state being produced.

runWriter :: Typeable w => (w -> b -> b) -> b -> Eff (Writer w :> r) a -> Eff r (b, a)Source

Handle Writer requests, using a user-provided function to accumulate values.

runFirstWriter :: Typeable w => Eff (Writer w :> r) a -> Eff r (Maybe w, a)Source

Handle Writer requests by taking the first value provided.

runLastWriter :: Typeable w => Eff (Writer w :> r) a -> Eff r (Maybe w, a)Source

Handle Writer requests by overwriting previous values.

runMonoidWriter :: (Monoid w, Typeable w) => Eff (Writer w :> r) a -> Eff r (w, a)Source

Handle Writer requests, using a Monoid instance to accumulate values.