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 (ListT) import Data.List.Class (execute, joinM, repeat, scanl, takeWhile) import Prelude hiding (repeat, scanl, takeWhile) main = execute . joinM . fmap print . scanl (+) 0 . fmap (fst . head) . takeWhile (not . null) . fmap reads . joinM $ (repeat getLine :: ListT IO (IO String))
Documentation
MonadTrans ListT | |
MonadReader s m => MonadReader s (ListT m) | |
MonadState s m => MonadState s (ListT m) | |
MonadError e m => MonadError e (ListT m) | |
Monad m => Monad (ListT m) | |
Monad m => Functor (ListT m) | |
Monad m => MonadPlus (ListT m) | |
Monad m => Applicative (ListT m) | |
MonadIO m => MonadIO (ListT m) | |
Monad m => List (ListT m) | |
Eq (m (ListItem (ListT m) a)) => Eq (ListT m a) | |
Ord (m (ListItem (ListT m) a)) => Ord (ListT m a) | |
Read (m (ListItem (ListT m) a)) => Read (ListT m a) | |
Show (m (ListItem (ListT m) a)) => Show (ListT m a) | |
Monad m => Monoid (ListT m a) |