Safe Haskell | Safe |
---|---|
Language | Haskell98 |
A list monad transformer / a monadic list.
Monadic list example: A program which reads numbers from the user and accumulates them.
import Control.Monad.ListT.Funcs (repeatM) import Data.List.Class (execute, scanl, takeWhile, mapL) import Prelude hiding (scanl, takeWhile) main = execute . mapL print . scanl (+) 0 . fmap (fst . head) . takeWhile (not . null) . fmap reads $ repeatM getLine
Note:
The transformers
package also has a ListT
type,
which oddly enough it is not a list monad transformer.
This module was deliberately named differently from transformers
's module.
Documentation
MonadTrans ListT Source # | |
Monad m => Monad (ListT m) Source # | |
Monad m => Functor (ListT m) Source # | |
Monad m => Applicative (ListT m) Source # | |
MonadIO m => MonadIO (ListT m) Source # | |
Monad m => Alternative (ListT m) Source # | |
Monad m => MonadPlus (ListT m) Source # | |
Monad m => List (ListT m) Source # | |
Eq (m (ListItem (ListT m) a)) => Eq (ListT m a) Source # | |
Ord (m (ListItem (ListT m) a)) => Ord (ListT m a) Source # | |
Read (m (ListItem (ListT m) a)) => Read (ListT m a) Source # | |
Show (m (ListItem (ListT m) a)) => Show (ListT m a) Source # | |
Monad m => Monoid (ListT m a) Source # | |
type ItemM (ListT m) Source # | |