class (Monoid w, Monad m) => MonadWriter w m
writer :: (a, w) -> m a
writer (a,w) embeds a simple writer action.
tell :: w -> m ()
tell w is an action that produces the output w.
listen :: m a -> m (a, w)
listen m is an action that executes the action m and adds
its output to the value of the computation.
pass :: m (a, w -> 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.
listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b)
listens f m is an action that executes the action m and adds
the result of applying f to the output to the value of the computation.
censor :: MonadWriter w m => (w -> w) -> m a -> m a
censor f m is an action that executes the action m and
applies the function f to its output, leaving the return value
unchanged.
Instances
15
instance (Monoid w) => MonadWriter w ((,) w)instance (Monoid w, Monad m) => MonadWriter w (CPS.WriterT w m)instance (Monoid w, Monad m) => MonadWriter w (Lazy.WriterT w m)instance (Monoid w, Monad m) => MonadWriter w (Strict.WriterT w m)instance (Monoid w, Monad m) => MonadWriter w (CPSRWS.RWST r w s m)instance (Monoid w, Monad m) => MonadWriter w (LazyRWS.RWST r w s m)instance (Monoid w, Monad m) => MonadWriter w (StrictRWS.RWST r w s m)instance MonadWriter w m => MonadWriter w (ExceptT e m)instance MonadWriter w m => MonadWriter w (IdentityT m)instance MonadWriter w m => MonadWriter w (MaybeT m)instance MonadWriter w m => MonadWriter w (ReaderT r m)instance MonadWriter w m => MonadWriter w (Lazy.StateT s m)instance MonadWriter w m => MonadWriter w (Strict.StateT s m)instance (Monoid w', MonadWriter w m) => MonadWriter w (AccumT w' m)There are two valid instances for AccumT. It could either:
Lift the operations to the inner MonadWriter
Handle the operations itself, à la a WriterT.
This instance chooses (1), reflecting that the intent
of AccumT as a type is different than that of WriterT.
instance (MonadWriter w m, MonadWriter w n) => MonadWriter w (Product m n)
- Maintainer
- libraries@haskell.org
- Portability
- non-portable (multi-param classes, functional dependencies)
- Copyright
- (c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001
- License
- BSD-style (see the file LICENSE)