Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Writer tag w = WriterT tag w Identity
- writer :: Monad m => proxy tag -> (a, w) -> WriterT tag w m a
- runWriter :: proxy tag -> Writer tag w a -> (a, w)
- execWriter :: proxy tag -> Writer tag w a -> w
- type WriterT tag w = TaggedTrans tag (WriterT w)
- writerT :: proxy tag -> m (a, w) -> WriterT tag w m a
- runWriterT :: proxy tag -> WriterT tag w m a -> m (a, w)
- execWriterT :: Monad m => proxy tag -> WriterT tag w m a -> m w
- tell :: Monad m => proxy tag -> w -> WriterT tag w m ()
- listen :: (Monad m, Monoid w) => proxy tag -> WriterT tag w m a -> WriterT tag w m (a, w)
- pass :: (Monad m, Monoid w) => proxy tag -> WriterT tag w m (a, w -> w) -> WriterT tag w m a
The Writer monad
writer :: Monad m => proxy tag -> (a, w) -> WriterT tag w m a Source
Constructor for computations in the writer monad
(the inverse of runWriter
).
runWriter :: proxy tag -> Writer tag w a -> (a, w) Source
Runs a Writer
and returns both the normal value
and the final accumulator.
execWriter :: proxy tag -> Writer tag w a -> w Source
Runs a Writer
and returns the final accumulator,
discarding the normal value.
The WriterT monad transformer
type WriterT tag w = TaggedTrans tag (WriterT w) Source
writerT :: proxy tag -> m (a, w) -> WriterT tag w m a Source
Constructor for computations in the writer monad transformer.
runWriterT :: proxy tag -> WriterT tag w m a -> m (a, w) Source
Runs a WriterT
and returns both the normal value
and the final accumulator.
execWriterT :: Monad m => proxy tag -> WriterT tag w m a -> m w Source
Runs a WriterT
and returns the final accumulator,
discarding the normal value.
Writer operations
tell :: Monad m => proxy tag -> w -> WriterT tag w m () Source
Appends a value to the accumulator within the monad.