Control.Monad.Trans.List

transformers-0.5.4.0: Concrete functor and monad transformers

Copyright | (c) Andy Gill 2001 (c) Oregon Graduate Institute of Science and Technology 2001
License | BSD-style (see the file LICENSE)
Maintainer | R.Paterson@city.ac.uk
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Control.Monad.Trans.List

Contents

- The ListT monad transformer
- Lifting other operations

Description

Deprecated: This transformer is invalid on most monads

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 :: CallCC m [a] [b] -> CallCC (ListT m) a b
- liftCatch :: Catch e m [a] -> Catch e (ListT m) a

# The ListT monad transformer

newtype ListT m a Source #

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 # |
Instance details Methods lift :: Monad m => m a -> ListT m a Source #
Monad m => Monad (ListT m) # |
Instance details Methods (>>=) :: ListT m a -> (a -> ListT m b) -> ListT m b Source # (>>) :: ListT m a -> ListT m b -> ListT m b Source # return :: a -> ListT m a Source # fail :: String -> ListT m a Source #
Functor m => Functor (ListT m) # |
Instance details Methods fmap :: (a -> b) -> ListT m a -> ListT m b Source # (<$) :: a -> ListT m b -> ListT m a Source #
Monad m => MonadFail (ListT m) # |
Instance details Methods fail :: String -> ListT m a Source #
Applicative m => Applicative (ListT m) # |
Instance details Methods pure :: a -> ListT m a Source # (<*>) :: ListT m (a -> b) -> ListT m a -> ListT m b Source # liftA2 :: (a -> b -> c) -> ListT m a -> ListT m b -> ListT m c Source # (*>) :: ListT m a -> ListT m b -> ListT m b Source # (<*) :: ListT m a -> ListT m b -> ListT m a Source #
Foldable f => Foldable (ListT f) # |
Instance details Methods fold :: Monoid m => ListT f m -> m Source # foldMap :: Monoid m => (a -> m) -> ListT f a -> m Source # foldr :: (a -> b -> b) -> b -> ListT f a -> b Source # foldr' :: (a -> b -> b) -> b -> ListT f a -> b Source # foldl :: (b -> a -> b) -> b -> ListT f a -> b Source # foldl' :: (b -> a -> b) -> b -> ListT f a -> b Source # foldr1 :: (a -> a -> a) -> ListT f a -> a Source # foldl1 :: (a -> a -> a) -> ListT f a -> a Source # toList :: ListT f a -> [a] Source # null :: ListT f a -> Bool Source # length :: ListT f a -> Int Source # elem :: Eq a => a -> ListT f a -> Bool Source # maximum :: Ord a => ListT f a -> a Source # minimum :: Ord a => ListT f a -> a Source # sum :: Num a => ListT f a -> a Source # product :: Num a => ListT f a -> a Source #
Traversable f => Traversable (ListT f) # |
Instance details Methods traverse :: Applicative f0 => (a -> f0 b) -> ListT f a -> f0 (ListT f b) Source # sequenceA :: Applicative f0 => ListT f (f0 a) -> f0 (ListT f a) Source # mapM :: Monad m => (a -> m b) -> ListT f a -> m (ListT f b) Source # sequence :: Monad m => ListT f (m a) -> m (ListT f a) Source #
Eq1 m => Eq1 (ListT m) # |
Instance details Methods liftEq :: (a -> b -> Bool) -> ListT m a -> ListT m b -> Bool Source #
Ord1 m => Ord1 (ListT m) # |
Instance details Methods liftCompare :: (a -> b -> Ordering) -> ListT m a -> ListT m b -> Ordering Source #
Read1 m => Read1 (ListT m) # |
Instance details Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ListT m a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ListT m a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ListT m a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ListT m a] Source #
Show1 m => Show1 (ListT m) # |
Instance details Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ListT m a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ListT m a] -> ShowS Source #
MonadZip m => MonadZip (ListT m) # |
Instance details Methods mzip :: ListT m a -> ListT m b -> ListT m (a, b) Source # mzipWith :: (a -> b -> c) -> ListT m a -> ListT m b -> ListT m c Source # munzip :: ListT m (a, b) -> (ListT m a, ListT m b) Source #
MonadIO m => MonadIO (ListT m) # |
Instance details Methods liftIO :: IO a -> ListT m a Source #
Applicative m => Alternative (ListT m) # |
Instance details Methods empty :: ListT m a Source # (<|>) :: ListT m a -> ListT m a -> ListT m a Source # some :: ListT m a -> ListT m [a] Source # many :: ListT m a -> ListT m [a] Source #
Monad m => MonadPlus (ListT m) # |
Instance details Methods mzero :: ListT m a Source # mplus :: ListT m a -> ListT m a -> ListT m a Source #
(Eq1 m, Eq a) => Eq (ListT m a) # |
Instance details Methods (==) :: ListT m a -> ListT m a -> Bool # (/=) :: ListT m a -> ListT m a -> Bool #
(Ord1 m, Ord a) => Ord (ListT m a) # |
Instance details Methods compare :: ListT m a -> ListT m a -> Ordering # (<) :: ListT m a -> ListT m a -> Bool # (<=) :: ListT m a -> ListT m a -> Bool # (>) :: ListT m a -> ListT m a -> Bool # (>=) :: ListT m a -> ListT m a -> Bool # max :: ListT m a -> ListT m a -> ListT m a # min :: ListT m a -> ListT m a -> ListT m a #
(Read1 m, Read a) => Read (ListT m a) # |
Instance details Methods readsPrec :: Int -> ReadS (ListT m a) Source # readList :: ReadS [ListT m a] Source # readPrec :: ReadPrec (ListT m a) Source # readListPrec :: ReadPrec [ListT m a] Source #
(Show1 m, Show a) => Show (ListT m a) # |
Instance details Methods showsPrec :: Int -> ListT m a -> ShowS Source # show :: ListT m a -> String Source # showList :: [ListT m a] -> ShowS Source #

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

Map between `ListT` computations.

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

# Lifting other operations

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

Lift a `callCC` operation to the new monad.

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

Lift a `catchE` operation to the new monad.