Copyright | (c) Daniel Mendler 2016, (c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | mail@daniel-mendler.de |
Stability | experimental |
Portability | non-portable (multi-param classes, functional dependencies) |
Safe Haskell | Safe |
Language | Haskell2010 |
Stricter writer monad using continuation-passing-style for the writer output.
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 :: Monoid w => Writer w a -> (a, w)
- execWriter :: Monoid w => Writer w a -> w
- mapWriter :: (Monoid w, Monoid w') => ((a, w) -> (b, w')) -> Writer w a -> Writer w' b
- data WriterT w m a :: * -> (* -> *) -> * -> *
- runWriterT :: Monoid w => WriterT w m a -> m (a, w)
- execWriterT :: (Monad m, Monoid w) => WriterT w m a -> m w
- mapWriterT :: (Monad n, Monoid w, Monoid w') => (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b
The Writer monad
execWriter :: Monoid w => Writer w a -> w #
The WriterT monad transformer
data WriterT w m a :: * -> (* -> *) -> * -> * #
MonadTrans (WriterT w) | |
Monad m => Monad (WriterT w m) | |
Functor m => Functor (WriterT w m) | |
MonadFix m => MonadFix (WriterT w m) | |
MonadFail m => MonadFail (WriterT w m) | |
(Functor m, Monad m) => Applicative (WriterT w m) | |
MonadIO m => MonadIO (WriterT w m) | |
(Functor m, MonadPlus m) => Alternative (WriterT w m) | |
(Functor m, MonadPlus m) => MonadPlus (WriterT w m) | |
runWriterT :: Monoid w => WriterT w m a -> m (a, w) #
execWriterT :: (Monad m, Monoid w) => WriterT w m a -> m w #
mapWriterT :: (Monad n, Monoid w, Monoid w') => (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b #