Control.Monad.Trans.List

transformers-0.3.0.0: Concrete functor and monad transformers

Portability | portable
Stability | experimental
Maintainer | ross@soi.city.ac.uk
Safe Haskell | Safe-Inferred

Control.Monad.Trans.List

Contents

- The ListT monad transformer
- Lifting other operations

Description

The ListT monad transformer, adding backtracking to a given monad, which must be commutative.

Synopsis

- newtype ListT m a = ListT {
  - runListT :: m [a]
  }
- mapListT :: (m [a] -> n [b]) -> ListT m a -> ListT n b
- liftCallCC :: ((([a] -> m [b]) -> m [a]) -> m [a]) -> ((a -> ListT m b) -> ListT m a) -> ListT m a
- liftCatch :: (m [a] -> (e -> m [a]) -> m [a]) -> ListT m a -> (e -> ListT m a) -> ListT m a

# The ListT monad transformer

newtype ListT m a

Parameterizable list monad, with an inner monad.

Note: this does not yield a monad unless the argument monad is commutative.

Constructors

ListT |
Fields runListT :: m [a]

Instances

MonadTrans ListT |
Monad m => Monad (ListT m) |
Functor m => Functor (ListT m) |
Monad m => MonadPlus (ListT m) |
Applicative m => Applicative (ListT m) |
Foldable f => Foldable (ListT f) |
Traversable f => Traversable (ListT f) |
Applicative m => Alternative (ListT m) |
MonadIO m => MonadIO (ListT m) |

mapListT :: (m [a] -> n [b]) -> ListT m a -> ListT n b

Map between `ListT` computations.

-     runListT (mapListT f m) = f (runListT m)

# Lifting other operations

liftCallCC :: ((([a] -> m [b]) -> m [a]) -> m [a]) -> ((a -> ListT m b) -> ListT m a) -> ListT m a

Lift a `callCC` operation to the new monad.

liftCatch :: (m [a] -> (e -> m [a]) -> m [a]) -> ListT m a -> (e -> ListT m a) -> ListT m a

Lift a `catchError` operation to the new monad.