transformers-0.1.4.0: Concrete monad transformersSource codeContentsIndex
Control.Monad.Trans.Writer.Lazy
Portabilityportable
Stabilityexperimental
Maintainerlibraries@haskell.org
Contents
The Writer monad
The WriterT monad transformer
Writer operations
Lifting other operations
Description
Lazy writer monads.
Synopsis
type Writer w = WriterT w Identity
writer :: (a, w) -> Writer w a
runWriter :: Writer w a -> (a, w)
execWriter :: Writer w a -> w
mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' b
newtype WriterT w m a = WriterT {
runWriterT :: m (a, w)
}
execWriterT :: Monad m => WriterT w m a -> m w
mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b
tell :: (Monoid w, Monad m) => w -> WriterT w m ()
listen :: (Monoid w, Monad m) => WriterT w m a -> WriterT w m (a, w)
pass :: (Monoid w, Monad m) => WriterT w m (a, w -> w) -> WriterT w m a
listens :: (Monoid w, Monad m) => (w -> b) -> WriterT w m a -> WriterT w m (a, b)
censor :: (Monoid w, Monad m) => (w -> w) -> WriterT w m a -> WriterT w m a
liftCallCC :: Monoid w => ((((a, w) -> m (b, w)) -> m (a, w)) -> m (a, w)) -> ((a -> WriterT w m b) -> WriterT w m a) -> WriterT w m a
liftCatch :: (m (a, w) -> (e -> m (a, w)) -> m (a, w)) -> WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a
The Writer monad
type Writer w = WriterT w IdentitySource
writer :: (a, w) -> Writer w aSource
runWriter :: Writer w a -> (a, w)Source
execWriter :: Writer w a -> wSource
mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' bSource
The WriterT monad transformer
newtype WriterT w m a Source
Constructors
WriterT
runWriterT :: m (a, w)
show/hide Instances
execWriterT :: Monad m => WriterT w m a -> m wSource
mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n bSource
Writer operations
tell :: (Monoid w, Monad m) => w -> WriterT w m ()Source
listen :: (Monoid w, Monad m) => WriterT w m a -> WriterT w m (a, w)Source
pass :: (Monoid w, Monad m) => WriterT w m (a, w -> w) -> WriterT w m aSource
listens :: (Monoid w, Monad m) => (w -> b) -> WriterT w m a -> WriterT w m (a, b)Source
censor :: (Monoid w, Monad m) => (w -> w) -> WriterT w m a -> WriterT w m aSource
Lifting other operations
liftCallCC :: Monoid w => ((((a, w) -> m (b, w)) -> m (a, w)) -> m (a, w)) -> ((a -> WriterT w m b) -> WriterT w m a) -> WriterT w m aSource
Lift a callCC operation to the new monad.
liftCatch :: (m (a, w) -> (e -> m (a, w)) -> m (a, w)) -> WriterT w m a -> (e -> WriterT w m a) -> WriterT w m aSource
Lift a catchError operation to the new monad.
Produced by Haddock version 2.4.2