HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleextensible-effects-5.0.0.1Haskell2010

Control.Eff.Writer.Strict

Strict write-only state

Synopsis
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.Strict
  • 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.Strict

    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.Strict
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.

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

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