monads-tf-0.1.0.3: Monad classes, using type families

Copyright | (c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001
License | BSD-style (see the file LICENSE)
Maintainer | ross@soi.city.ac.uk
Stability | experimental
Portability | non-portable (type families)
Safe Haskell | Safe
Language | Haskell98

Control.Monad.Writer.Class

Description

The MonadWriter class.

Inspired by the paper /Functional Programming with Overloading and Higher-Order Polymorphism/, Mark P Jones (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html) Advanced School of Functional Programming, 1995.

# Documentation

class (Monoid (WriterType m), Monad m) => MonadWriter m where #

Minimal complete definition

tell, listen, pass

Associated Types

type WriterType m #

Methods

tell :: WriterType m -> m () #

listen :: m a -> m (a, WriterType m) #

pass :: m (a, WriterType m -> WriterType m) -> m a #

Instances

MonadWriter m => MonadWriter (MaybeT m) # |
Associated Types type WriterType (MaybeT m :: * -> *) :: * # Methods tell :: WriterType (MaybeT m) -> MaybeT m () # listen :: MaybeT m a -> MaybeT m (a, WriterType (MaybeT m)) # pass :: MaybeT m (a, WriterType (MaybeT m) -> WriterType (MaybeT m)) -> MaybeT m a #
(Monoid w, Monad m) => MonadWriter (WriterT w m) # |
Associated Types type WriterType (WriterT w m :: * -> *) :: * # Methods tell :: WriterType (WriterT w m) -> WriterT w m () # listen :: WriterT w m a -> WriterT w m (a, WriterType (WriterT w m)) # pass :: WriterT w m (a, WriterType (WriterT w m) -> WriterType (WriterT w m)) -> WriterT w m a #
(Monoid w, Monad m) => MonadWriter (WriterT w m) # |
Associated Types type WriterType (WriterT w m :: * -> *) :: * # Methods tell :: WriterType (WriterT w m) -> WriterT w m () # listen :: WriterT w m a -> WriterT w m (a, WriterType (WriterT w m)) # pass :: WriterT w m (a, WriterType (WriterT w m) -> WriterType (WriterT w m)) -> WriterT w m a #
MonadWriter m => MonadWriter (StateT s m) # |
Associated Types type WriterType (StateT s m :: * -> *) :: * # Methods tell :: WriterType (StateT s m) -> StateT s m () # listen :: StateT s m a -> StateT s m (a, WriterType (StateT s m)) # pass :: StateT s m (a, WriterType (StateT s m) -> WriterType (StateT s m)) -> StateT s m a #
MonadWriter m => MonadWriter (StateT s m) # |
Associated Types type WriterType (StateT s m :: * -> *) :: * # Methods tell :: WriterType (StateT s m) -> StateT s m () # listen :: StateT s m a -> StateT s m (a, WriterType (StateT s m)) # pass :: StateT s m (a, WriterType (StateT s m) -> WriterType (StateT s m)) -> StateT s m a #
MonadWriter m => MonadWriter (IdentityT * m) # |
Associated Types type WriterType (IdentityT * m :: * -> *) :: * # Methods tell :: WriterType (IdentityT * m) -> IdentityT * m () # listen :: IdentityT * m a -> IdentityT * m (a, WriterType (IdentityT * m)) # pass :: IdentityT * m (a, WriterType (IdentityT * m) -> WriterType (IdentityT * m)) -> IdentityT * m a #
(Error e, MonadWriter m) => MonadWriter (ErrorT e m) # |
Associated Types type WriterType (ErrorT e m :: * -> *) :: * # Methods tell :: WriterType (ErrorT e m) -> ErrorT e m () # listen :: ErrorT e m a -> ErrorT e m (a, WriterType (ErrorT e m)) # pass :: ErrorT e m (a, WriterType (ErrorT e m) -> WriterType (ErrorT e m)) -> ErrorT e m a #
MonadWriter m => MonadWriter (ReaderT * r m) # |
Associated Types type WriterType (ReaderT * r m :: * -> *) :: * # Methods tell :: WriterType (ReaderT * r m) -> ReaderT * r m () # listen :: ReaderT * r m a -> ReaderT * r m (a, WriterType (ReaderT * r m)) # pass :: ReaderT * r m (a, WriterType (ReaderT * r m) -> WriterType (ReaderT * r m)) -> ReaderT * r m a #
(Monoid w, Monad m) => MonadWriter (RWST r w s m) # |
Associated Types type WriterType (RWST r w s m :: * -> *) :: * # Methods tell :: WriterType (RWST r w s m) -> RWST r w s m () # listen :: RWST r w s m a -> RWST r w s m (a, WriterType (RWST r w s m)) # pass :: RWST r w s m (a, WriterType (RWST r w s m) -> WriterType (RWST r w s m)) -> RWST r w s m a #
(Monoid w, Monad m) => MonadWriter (RWST r w s m) # |
Associated Types type WriterType (RWST r w s m :: * -> *) :: * # Methods tell :: WriterType (RWST r w s m) -> RWST r w s m () # listen :: RWST r w s m a -> RWST r w s m (a, WriterType (RWST r w s m)) # pass :: RWST r w s m (a, WriterType (RWST r w s m) -> WriterType (RWST r w s m)) -> RWST r w s m a #

listens :: MonadWriter m => (WriterType m -> b) -> m a -> m (a, b) #

censor :: MonadWriter m => (WriterType m -> WriterType m) -> m a -> m a #