-- Module : Control.Monad.Writer
-- Copyright : (c) Andy Gill 2001,
-- (c) Oregon Graduate Institute of Science and Technology, 2001
--- License : BSD-style (see the file libraries/core/LICENSE)
+-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
-- Inspired by the paper
-- /Functional Programming with Overloading and
-- Higher-Order Polymorphism/,
--- Mark P Jones (<http://www.cse.ogi.edu/~mpj>)
+-- Mark P Jones (<http://www.cse.ogi.edu/~mpj/>)
-- Advanced School of Functional Programming, 1995.
-----------------------------------------------------------------------------
listens,
censor,
Writer(..),
- runWriter,
execWriter,
mapWriter,
WriterT(..),
- runWriterT,
execWriterT,
mapWriterT,
module Control.Monad,
- module Control.Monad.Monoid,
module Control.Monad.Fix,
module Control.Monad.Trans,
+ module Data.Monoid,
) where
import Prelude
import Control.Monad
-import Control.Monad.Monoid
import Control.Monad.Fix
import Control.Monad.Trans
import Control.Monad.Reader
+import Data.Monoid
-- ---------------------------------------------------------------------------
-- MonadWriter class
listen :: m a -> m (a, w)
pass :: m (a, w -> w) -> m a
-listens :: (MonadWriter w m) => (w -> w) -> m a -> m (a, w)
+listens :: (MonadWriter w m) => (w -> b) -> m a -> m (a, b)
listens f m = do
(a, w) <- listen m
return (a, f w)