Control.Monad.Trans.Identity

transformers-0.6.1.1: Concrete functor and monad transformers

Copyright | (c) 2007 Magnus Therning
License | BSD-style (see the file LICENSE)
Maintainer | R.Paterson@city.ac.uk
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Control.Monad.Trans.Identity

Contents

- The identity monad transformer
- Lifting other operations

Description

The identity monad transformer.

This is useful for functions parameterized by a monad transformer.

Synopsis

- newtype IdentityT (f :: k -> Type) (a :: k) = IdentityT {
  - runIdentityT :: f a
  }
- mapIdentityT :: forall {k1} {k2} m (a :: k1) n (b :: k2). (m a -> n b) -> IdentityT m a -> IdentityT n b
- liftCatch :: forall {k} e m (a :: k). Catch e m a -> Catch e (IdentityT m) a
- liftCallCC :: CallCC m a b -> CallCC (IdentityT m) a b

# The identity monad transformer

newtype IdentityT (f :: k -> Type) (a :: k) Source #

The trivial monad transformer, which maps a monad to an equivalent monad.

Constructors

IdentityT |
Fields runIdentityT :: f a

#### Instances

Instances details

Generic1 (IdentityT f :: k -> Type) Source # |
Instance details Defined in Control.Monad.Trans.Identity Associated Types
type Rep1 (IdentityT f :: k -> Type) |
Instance details Defined in Control.Monad.Trans.Identity type Rep1 (IdentityT f :: k -> Type) = D1 ('MetaData "IdentityT" "Control.Monad.Trans.Identity" "transformers-0.6.1.1-2aba" 'True) (C1 ('MetaCons "IdentityT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentityT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
Methods from1 :: forall (a :: k). IdentityT f a -> Rep1 (IdentityT f) a # to1 :: forall (a :: k). Rep1 (IdentityT f) a -> IdentityT f a #
MonadTrans (IdentityT :: (Type -> Type) -> Type -> Type) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods lift :: Monad m => m a -> IdentityT m a Source #
MonadIO m => MonadIO (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods liftIO :: IO a -> IdentityT m a Source #
MonadZip m => MonadZip (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods mzip :: IdentityT m a -> IdentityT m b -> IdentityT m (a, b) Source # mzipWith :: (a -> b -> c) -> IdentityT m a -> IdentityT m b -> IdentityT m c Source # munzip :: IdentityT m (a, b) -> (IdentityT m a, IdentityT m b) Source #
Foldable1 m => Foldable1 (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods fold1 :: Semigroup m0 => IdentityT m m0 -> m0 Source # foldMap1 :: Semigroup m0 => (a -> m0) -> IdentityT m a -> m0 Source # foldMap1' :: Semigroup m0 => (a -> m0) -> IdentityT m a -> m0 Source # toNonEmpty :: IdentityT m a -> NonEmpty a Source # maximum :: Ord a => IdentityT m a -> a Source # minimum :: Ord a => IdentityT m a -> a Source # head :: IdentityT m a -> a Source # last :: IdentityT m a -> a Source # foldrMap1 :: (a -> b) -> (a -> b -> b) -> IdentityT m a -> b Source # foldlMap1' :: (a -> b) -> (b -> a -> b) -> IdentityT m a -> b Source # foldlMap1 :: (a -> b) -> (b -> a -> b) -> IdentityT m a -> b Source # foldrMap1' :: (a -> b) -> (a -> b -> b) -> IdentityT m a -> b Source #
Eq1 f => Eq1 (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods liftEq :: (a -> b -> Bool) -> IdentityT f a -> IdentityT f b -> Bool Source #
Ord1 f => Ord1 (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods liftCompare :: (a -> b -> Ordering) -> IdentityT f a -> IdentityT f b -> Ordering Source #
Read1 f => Read1 (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (IdentityT f a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [IdentityT f a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (IdentityT f a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [IdentityT f a] Source #
Show1 f => Show1 (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> IdentityT f a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [IdentityT f a] -> ShowS Source #
Contravariant f => Contravariant (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods contramap :: (a' -> a) -> IdentityT f a -> IdentityT f a' Source # (>$) :: b -> IdentityT f b -> IdentityT f a Source #
Alternative m => Alternative (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods empty :: IdentityT m a # (<|>) :: IdentityT m a -> IdentityT m a -> IdentityT m a # some :: IdentityT m a -> IdentityT m [a] # many :: IdentityT m a -> IdentityT m [a] #
Applicative m => Applicative (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods pure :: a -> IdentityT m a # (<*>) :: IdentityT m (a -> b) -> IdentityT m a -> IdentityT m b # liftA2 :: (a -> b -> c) -> IdentityT m a -> IdentityT m b -> IdentityT m c # (*>) :: IdentityT m a -> IdentityT m b -> IdentityT m b # (<*) :: IdentityT m a -> IdentityT m b -> IdentityT m a #
Functor m => Functor (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods fmap :: (a -> b) -> IdentityT m a -> IdentityT m b # (<$) :: a -> IdentityT m b -> IdentityT m a #
Monad m => Monad (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods (>>=) :: IdentityT m a -> (a -> IdentityT m b) -> IdentityT m b # (>>) :: IdentityT m a -> IdentityT m b -> IdentityT m b # return :: a -> IdentityT m a #
MonadPlus m => MonadPlus (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods mzero :: IdentityT m a # mplus :: IdentityT m a -> IdentityT m a -> IdentityT m a #
MonadFail m => MonadFail (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods fail :: String -> IdentityT m a #
MonadFix m => MonadFix (IdentityT m) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods mfix :: (a -> IdentityT m a) -> IdentityT m a #
Foldable f => Foldable (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods fold :: Monoid m => IdentityT f m -> m # foldMap :: Monoid m => (a -> m) -> IdentityT f a -> m # foldMap' :: Monoid m => (a -> m) -> IdentityT f a -> m # foldr :: (a -> b -> b) -> b -> IdentityT f a -> b # foldr' :: (a -> b -> b) -> b -> IdentityT f a -> b # foldl :: (b -> a -> b) -> b -> IdentityT f a -> b # foldl' :: (b -> a -> b) -> b -> IdentityT f a -> b # foldr1 :: (a -> a -> a) -> IdentityT f a -> a # foldl1 :: (a -> a -> a) -> IdentityT f a -> a # toList :: IdentityT f a -> [a] # null :: IdentityT f a -> Bool # length :: IdentityT f a -> Int # elem :: Eq a => a -> IdentityT f a -> Bool # maximum :: Ord a => IdentityT f a -> a # minimum :: Ord a => IdentityT f a -> a # sum :: Num a => IdentityT f a -> a # product :: Num a => IdentityT f a -> a #
Traversable f => Traversable (IdentityT f) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods traverse :: Applicative f0 => (a -> f0 b) -> IdentityT f a -> f0 (IdentityT f b) # sequenceA :: Applicative f0 => IdentityT f (f0 a) -> f0 (IdentityT f a) # mapM :: Monad m => (a -> m b) -> IdentityT f a -> m (IdentityT f b) # sequence :: Monad m => IdentityT f (m a) -> m (IdentityT f a) #
Generic (IdentityT f a) Source # |
Instance details Defined in Control.Monad.Trans.Identity Associated Types
type Rep (IdentityT f a) |
Instance details Defined in Control.Monad.Trans.Identity type Rep (IdentityT f a) = D1 ('MetaData "IdentityT" "Control.Monad.Trans.Identity" "transformers-0.6.1.1-2aba" 'True) (C1 ('MetaCons "IdentityT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentityT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))
Methods from :: IdentityT f a -> Rep (IdentityT f a) x # to :: Rep (IdentityT f a) x -> IdentityT f a #
(Read1 f, Read a) => Read (IdentityT f a) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods readsPrec :: Int -> ReadS (IdentityT f a) # readList :: ReadS [IdentityT f a] # readPrec :: ReadPrec (IdentityT f a) # readListPrec :: ReadPrec [IdentityT f a] #
(Show1 f, Show a) => Show (IdentityT f a) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods showsPrec :: Int -> IdentityT f a -> ShowS # show :: IdentityT f a -> String # showList :: [IdentityT f a] -> ShowS #
(Eq1 f, Eq a) => Eq (IdentityT f a) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods (==) :: IdentityT f a -> IdentityT f a -> Bool # (/=) :: IdentityT f a -> IdentityT f a -> Bool #
(Ord1 f, Ord a) => Ord (IdentityT f a) Source # |
Instance details Defined in Control.Monad.Trans.Identity Methods compare :: IdentityT f a -> IdentityT f a -> Ordering # (<) :: IdentityT f a -> IdentityT f a -> Bool # (<=) :: IdentityT f a -> IdentityT f a -> Bool # (>) :: IdentityT f a -> IdentityT f a -> Bool # (>=) :: IdentityT f a -> IdentityT f a -> Bool # max :: IdentityT f a -> IdentityT f a -> IdentityT f a # min :: IdentityT f a -> IdentityT f a -> IdentityT f a #
type Rep1 (IdentityT f :: k -> Type) Source # |
Instance details Defined in Control.Monad.Trans.Identity type Rep1 (IdentityT f :: k -> Type) = D1 ('MetaData "IdentityT" "Control.Monad.Trans.Identity" "transformers-0.6.1.1-2aba" 'True) (C1 ('MetaCons "IdentityT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentityT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
type Rep (IdentityT f a) Source # |
Instance details Defined in Control.Monad.Trans.Identity type Rep (IdentityT f a) = D1 ('MetaData "IdentityT" "Control.Monad.Trans.Identity" "transformers-0.6.1.1-2aba" 'True) (C1 ('MetaCons "IdentityT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentityT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a))))

mapIdentityT :: forall {k1} {k2} m (a :: k1) n (b :: k2). (m a -> n b) -> IdentityT m a -> IdentityT n b Source #

Lift a unary operation to the new monad.

# Lifting other operations

liftCatch :: forall {k} e m (a :: k). Catch e m a -> Catch e (IdentityT m) a Source #

Lift a `catchE` operation to the new monad.

liftCallCC :: CallCC m a b -> CallCC (IdentityT m) a b Source #

Lift a `callCC` operation to the new monad.