Safe Haskell | None |
---|---|
Language | Haskell2010 |
- MonadWriter class
- The Writer monad
- The WriterT monad transformer
- The Writer monad (lazy)
- The WriterT monad transformer (lazy)
- MonadWriter class (implicit)
- The Writer monad (implicit)
- The WriterT monad transformer (implicit)
- The Writer monad (lazy, implicit)
- The WriterT monad transformer (lazy, implicit)
- Internal labels
- class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where
- writer :: MonadWriter tag w m => (a, w) -> m a
- tell :: MonadWriter tag w m => w -> m ()
- listen :: MonadWriter tag w m => m a -> m (a, w)
- pass :: MonadWriter tag w m => m (a, w -> w) -> m a
- listens :: forall tag w m a b. MonadWriter tag w m => (w -> b) -> m a -> m (a, b)
- censor :: forall tag w m a. MonadWriter tag w m => (w -> w) -> m a -> m a
- type Writer tag w = WriterT tag w Identity
- runWriter :: forall tag w a. Monoid w => Writer tag w a -> (a, w)
- execWriter :: forall tag w a. Monoid w => Writer tag w a -> w
- type WriterT tag w = TaggedTrans (TAGGED WRITER tag) (WriterT w)
- writerT :: forall tag w m a. (Functor m, Monoid w) => m (a, w) -> WriterT tag w m a
- runWriterT :: forall tag w m a. Monoid w => WriterT tag w m a -> m (a, w)
- execWriterT :: forall tag w m a. (Monad m, Monoid w) => WriterT tag w m a -> m w
- type LazyWriter tag w = LazyWriterT tag w Identity
- runLazyWriter :: forall tag w a. LazyWriter tag w a -> (a, w)
- execLazyWriter :: forall tag w a. LazyWriter tag w a -> w
- type LazyWriterT tag w = TaggedTrans (TAGGED WRITER tag) (WriterT w)
- lazyWriterT :: forall tag w m a. m (a, w) -> LazyWriterT tag w m a
- runLazyWriterT :: forall tag w m a. LazyWriterT tag w m a -> m (a, w)
- execLazyWriterT :: forall tag w m a. Monad m => LazyWriterT tag w m a -> m w
- type MonadWriter' w = MonadWriter w w
- writer' :: forall w m a. MonadWriter' w m => (a, w) -> m a
- tell' :: forall w m. MonadWriter' w m => w -> m ()
- listen' :: forall w m a. MonadWriter' w m => m a -> m (a, w)
- pass' :: forall w m a. MonadWriter' w m => m (a, w -> w) -> m a
- listens' :: forall w m a b. MonadWriter' w m => (w -> b) -> m a -> m (a, b)
- censor' :: forall w m a. MonadWriter' w m => (w -> w) -> m a -> m a
- type Writer' w = Writer w w
- runWriter' :: Monoid w => Writer' w a -> (a, w)
- execWriter' :: Monoid w => Writer' w a -> w
- type WriterT' w = WriterT w w
- writerT' :: (Functor m, Monoid w) => m (a, w) -> WriterT' w m a
- runWriterT' :: Monoid w => WriterT' w m a -> m (a, w)
- execWriterT' :: (Monad m, Monoid w) => WriterT' w m a -> m w
- type LazyWriter' w = LazyWriter w w
- runLazyWriter' :: LazyWriter' w a -> (a, w)
- execLazyWriter' :: LazyWriter' w a -> w
- type LazyWriterT' w = LazyWriterT w w
- lazyWriterT' :: m (a, w) -> LazyWriterT' w m a
- runLazyWriterT' :: LazyWriterT' w m a -> m (a, w)
- execLazyWriterT' :: Monad m => LazyWriterT' w m a -> m w
- data TAGGED e t
- data WRITER
MonadWriter class
class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where Source #
writer :: (a, w) -> m a Source #
Embed a simple writer action.
Append a value to the accumulator within the monad.
listen :: m a -> m (a, w) Source #
Execute an action and add its accumulator to the value of the computation.
pass :: m (a, w -> w) -> m a Source #
Execute an action which returns a value and a function, and return the value, applying the function to the accumulator.
(LiftListen t, LiftPass t, Monad (t m), MonadWriter k tag w m, Monoid w) => MonadWriter k tag w (t m) Source # | |
(MonadWriter k1 tNew w m, (~) ((* -> *) -> * -> *) trans (IdentityT *)) => MonadWriter k tOld w (TaggedTrans * (* -> *) * (TAG_REPLACE k1 k tOld tNew) trans m) Source # | |
writer :: MonadWriter tag w m => (a, w) -> m a Source #
Embed a simple writer action.
tell :: MonadWriter tag w m => w -> m () Source #
Append a value to the accumulator within the monad.
listen :: MonadWriter tag w m => m a -> m (a, w) Source #
Execute an action and add its accumulator to the value of the computation.
pass :: MonadWriter tag w m => m (a, w -> w) -> m a Source #
Execute an action which returns a value and a function, and return the value, applying the function to the accumulator.
listens :: forall tag w m a b. MonadWriter tag w m => (w -> b) -> m a -> m (a, b) Source #
Execute an action and add the result of applying the given function to its accumulator to the value of the computation.
censor :: forall tag w m a. MonadWriter tag w m => (w -> w) -> m a -> m a Source #
Execute an action and apply a function to its accumulator.
The Writer monad
runWriter :: forall tag w a. Monoid w => Writer tag w a -> (a, w) Source #
Runs a Writer
and returns both the normal value
and the final accumulator.
execWriter :: forall tag w a. Monoid w => Writer tag w a -> w Source #
Runs a Writer
and returns the final accumulator,
discarding the normal value.
The WriterT monad transformer
writerT :: forall tag w m a. (Functor m, Monoid w) => m (a, w) -> WriterT tag w m a Source #
Constructor for computations in the writer monad transformer.
runWriterT :: forall tag w m a. Monoid w => WriterT tag w m a -> m (a, w) Source #
Runs a WriterT
and returns both the normal value
and the final accumulator.
execWriterT :: forall tag w m a. (Monad m, Monoid w) => WriterT tag w m a -> m w Source #
Runs a WriterT
and returns the final accumulator,
discarding the normal value.
The Writer monad (lazy)
type LazyWriter tag w = LazyWriterT tag w Identity Source #
runLazyWriter :: forall tag w a. LazyWriter tag w a -> (a, w) Source #
Runs a Writer
and returns both the normal value
and the final accumulator.
execLazyWriter :: forall tag w a. LazyWriter tag w a -> w Source #
Runs a Writer
and returns the final accumulator,
discarding the normal value.
The WriterT monad transformer (lazy)
type LazyWriterT tag w = TaggedTrans (TAGGED WRITER tag) (WriterT w) Source #
lazyWriterT :: forall tag w m a. m (a, w) -> LazyWriterT tag w m a Source #
Constructor for computations in the writer monad transformer.
runLazyWriterT :: forall tag w m a. LazyWriterT tag w m a -> m (a, w) Source #
Runs a WriterT
and returns both the normal value
and the final accumulator.
execLazyWriterT :: forall tag w m a. Monad m => LazyWriterT tag w m a -> m w Source #
Runs a WriterT
and returns the final accumulator,
discarding the normal value.
MonadWriter class (implicit)
type MonadWriter' w = MonadWriter w w Source #
writer' :: forall w m a. MonadWriter' w m => (a, w) -> m a Source #
tell' :: forall w m. MonadWriter' w m => w -> m () Source #
listen' :: forall w m a. MonadWriter' w m => m a -> m (a, w) Source #
pass' :: forall w m a. MonadWriter' w m => m (a, w -> w) -> m a Source #
listens' :: forall w m a b. MonadWriter' w m => (w -> b) -> m a -> m (a, b) Source #
censor' :: forall w m a. MonadWriter' w m => (w -> w) -> m a -> m a Source #
The Writer monad (implicit)
runWriter' :: Monoid w => Writer' w a -> (a, w) Source #
execWriter' :: Monoid w => Writer' w a -> w Source #
The WriterT monad transformer (implicit)
runWriterT' :: Monoid w => WriterT' w m a -> m (a, w) Source #
The Writer monad (lazy, implicit)
type LazyWriter' w = LazyWriter w w Source #
runLazyWriter' :: LazyWriter' w a -> (a, w) Source #
execLazyWriter' :: LazyWriter' w a -> w Source #
The WriterT monad transformer (lazy, implicit)
type LazyWriterT' w = LazyWriterT w w Source #
lazyWriterT' :: m (a, w) -> LazyWriterT' w m a Source #
runLazyWriterT' :: LazyWriterT' w m a -> m (a, w) Source #
execLazyWriterT' :: Monad m => LazyWriterT' w m a -> m w Source #