HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulererebase-1.21.2Haskell2010

Control.Monad.Trans.Writer.Strict

  • 2 types
  • 13 values
  • Packagererebase-1.21.2
  • Exports15
  • LanguageHaskell2010
  • LicenceMIT
  • SourceStrict.hs
valuerunWriter :: Writer w a -> (a, w)
#

Unwrap a writer computation as a (result, output) pair. (The inverse of writer.)

valuepass :: Monad m => WriterT w m (a, w -> w) -> WriterT w m a
#

pass m is an action that executes the action m, which returns a value and a function, and returns the value, applying the function to the output.

valuewriter :: Monad m => (a, w) -> WriterT w m a
#

Construct a writer computation from a (result, output) pair. (The inverse of runWriter.)

newtypenewtype WriterT w (m :: Type -> Type) a
#

A writer monad parameterized by:

  • w - the output to accumulate.

  • m - The inner monad.

The return function produces the output mempty, while m >>= k combines the outputs of the subcomputations using mappend (also known as <>):

image: images/bind-WriterT.svg

Constructors

Instances51MonadAccum, MonadError, MonadReader, MonadState, MonadWriter, MonadSelect, …