Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Lazy write-only state.
- data Writer w v = Writer w v
- tell :: (Typeable w, Member (Writer w) r) => w -> Eff r ()
- censor :: (Typeable w, Member (Writer w) r) => (w -> w) -> Eff r a -> Eff r a
- runWriter :: Typeable w => (w -> b -> b) -> b -> Eff (Writer w :> r) a -> Eff r (b, a)
- runFirstWriter :: Typeable w => Eff (Writer w :> r) a -> Eff r (Maybe w, a)
- runLastWriter :: Typeable w => Eff (Writer w :> r) a -> Eff r (Maybe w, a)
- runMonoidWriter :: (Monoid w, Typeable w) => Eff (Writer w :> r) a -> Eff r (w, a)
Documentation
The request to remember a value of type w in the current environment
Writer w v |
censor :: (Typeable w, Member (Writer w) r) => (w -> w) -> Eff r a -> Eff r a Source
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.