Portability | non-portable (multi-param classes, functional dependencies) |
---|---|

Stability | experimental |

Maintainer | libraries@haskell.org |

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 whereSource

tell :: WriterType m -> m ()Source

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

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

Monoid w => MonadWriter (Writer w) | |

Monoid w => MonadWriter (Writer w) | |

MonadWriter m => MonadWriter (ReaderT r m) | |

(Error e, MonadWriter m) => MonadWriter (ErrorT e m) | |

MonadWriter m => MonadWriter (StateT s m) | |

MonadWriter m => MonadWriter (StateT s m) | |

(Monoid w, Monad m) => MonadWriter (WriterT w m) | |

(Monoid w, Monad m) => MonadWriter (WriterT w m) | |

Monoid w => MonadWriter (RWS r w s) | |

Monoid w => MonadWriter (RWS r w s) | |

(Monoid w, Monad m) => MonadWriter (RWST r w s m) | |

(Monoid w, Monad m) => MonadWriter (RWST r w s m) |

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

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

type family WriterType m Source