HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleextensible-effects-5.0.0.1Haskell2010

Control.Eff.Writer.Lazy

Lazy write-only state

  • 1 type
  • 13 values
datadata Writer w v where
#

The Writer monad

In MTL's Writer monad, the told value must have a |Monoid| type. Our writer has no such constraints. If we write a |Writer|-like interpreter to accumulate the told values in a monoid, it will have the |Monoid w| constraint then

Constructors

Instances3MonadBaseControl, Handle, StM
  • (MonadBase m m, LiftedBase m r) => MonadBaseControl m (Eff (Writer w ': r))Defined in extensible-effects-5.0.0.1 · Control.Eff.Writer.Lazy
  • Monad m => Handle (Writer w) r a (b -> (w -> b -> b) -> m (a, b))Defined in extensible-effects-5.0.0.1 · Control.Eff.Writer.Lazy

    Given a value to write, and a callback (which includes empty and append), respond to requests.

  • type StM (Eff (Writer w ': r)) a = StM (Eff r) (a, [w])Defined in extensible-effects-5.0.0.1 · Control.Eff.Writer.Lazy
valuewithWriter :: Monad m => a -> b -> (w -> b -> b) -> m (a, b)
#

How to interpret a pure value in a writer context, given the value for mempty.

valuerunWriter :: (w -> b -> b) -> b -> Eff (Writer w ': r) a -> Eff r (a, b)
#

Handle Writer requests, using a user-provided function to accumulate values, hence no Monoid constraints.

valueexecWriter :: (w -> b -> b) -> b -> Eff (Writer w ': r) a -> Eff r b
#

Handle Writer requests, using a user-provided function to accumulate values and returning the final accumulated values.

valueexecFirstWriter :: Eff (Writer w ': r) a -> Eff r (Maybe w)
#

Handle Writer requests by taking the first value provided and and returning the final accumulated values.

valueexecLastWriter :: Eff (Writer w ': r) a -> Eff r (Maybe w)
#

Handle Writer requests by overwriting previous values and returning the final accumulated values.

valueexecListWriter :: Eff (Writer w ': r) a -> Eff r [w]
#

Handle Writer requests, using a List to accumulate values and returning the final accumulated values.

valueexecMonoidWriter :: Monoid w => Eff (Writer w ': r) a -> Eff r w
#

Handle Writer requests, using a Monoid instance to accumulate values and returning the final accumulated values.