Portability | portable |
---|---|
Stability | experimental |
Maintainer | libraries@haskell.org |
Lazy writer monads.
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.
- type Writer w = WriterT w Identity
- runWriter :: Writer w a -> (a, w)
- execWriter :: Writer w a -> w
- mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' b
- newtype WriterT w m a = WriterT {
- runWriterT :: m (a, w)
- execWriterT :: Monad m => WriterT w m a -> m w
- mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b
- tell :: (Monoid w, Monad m) => w -> WriterT w m ()
- listen :: (Monoid w, Monad m) => WriterT w m a -> WriterT w m (a, w)
- pass :: (Monoid w, Monad m) => WriterT w m (a, w -> w) -> WriterT w m a
- listens :: (Monoid w, Monad m) => (w -> b) -> WriterT w m a -> WriterT w m (a, b)
- censor :: (Monoid w, Monad m) => (w -> w) -> WriterT w m a -> WriterT w m a
- liftCallCC :: Monoid w => ((((a, w) -> m (b, w)) -> m (a, w)) -> m (a, w)) -> ((a -> WriterT w m b) -> WriterT w m a) -> WriterT w m a
- liftCatch :: (m (a, w) -> (e -> m (a, w)) -> m (a, w)) -> WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a
The Writer monad
execWriter :: Writer w a -> wSource
The WriterT monad transformer
WriterT | |
|
execWriterT :: Monad m => WriterT w m a -> m wSource
mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n bSource