Data.Functor.Identity

base-4.10.1.0: Basic libraries

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

Data.Functor.Identity

Description

The identity functor and monad.

This trivial type constructor serves two purposes:

- It can be used with functions parameterized by functor or monad classes.
- It can be used as a base monad to which a series of monad transformers may be applied to construct a composite monad. Most monad transformer modules include the special case of applying the transformer to `Identity`. For example, `State s` is an abbreviation for `StateT s `Identity``.

Since: 4.8.0.0

Synopsis

- newtype Identity a = Identity {
  - runIdentity :: a
  }

# Documentation

newtype Identity a Source #

Identity functor and monad. (a non-strict monad)

Since: 4.8.0.0

Constructors

Identity |
Fields runIdentity :: a

Instances

Monad Identity # | Since: 4.8.0.0
Methods (>>=) :: Identity a -> (a -> Identity b) -> Identity b Source # (>>) :: Identity a -> Identity b -> Identity b Source # return :: a -> Identity a Source # fail :: String -> Identity a Source #
Functor Identity # | Since: 4.8.0.0
Methods fmap :: (a -> b) -> Identity a -> Identity b Source # (<$) :: a -> Identity b -> Identity a Source #
MonadFix Identity # | Since: 4.8.0.0
Methods mfix :: (a -> Identity a) -> Identity a Source #
Applicative Identity # | Since: 4.8.0.0
Methods pure :: a -> Identity a Source # (<*>) :: Identity (a -> b) -> Identity a -> Identity b Source # liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source # (*>) :: Identity a -> Identity b -> Identity b Source # (<*) :: Identity a -> Identity b -> Identity a Source #
Foldable Identity # | Since: 4.8.0.0
Methods fold :: Monoid m => Identity m -> m Source # foldMap :: Monoid m => (a -> m) -> Identity a -> m Source # foldr :: (a -> b -> b) -> b -> Identity a -> b Source # foldr' :: (a -> b -> b) -> b -> Identity a -> b Source # foldl :: (b -> a -> b) -> b -> Identity a -> b Source # foldl' :: (b -> a -> b) -> b -> Identity a -> b Source # foldr1 :: (a -> a -> a) -> Identity a -> a Source # foldl1 :: (a -> a -> a) -> Identity a -> a Source # toList :: Identity a -> [a] Source # null :: Identity a -> Bool Source # length :: Identity a -> Int Source # elem :: Eq a => a -> Identity a -> Bool Source # maximum :: Ord a => Identity a -> a Source # minimum :: Ord a => Identity a -> a Source # sum :: Num a => Identity a -> a Source # product :: Num a => Identity a -> a Source #
Traversable Identity # |
Methods traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) Source # sequenceA :: Applicative f => Identity (f a) -> f (Identity a) Source # mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) Source # sequence :: Monad m => Identity (m a) -> m (Identity a) Source #
MonadZip Identity # | Since: 4.8.0.0
Methods mzip :: Identity a -> Identity b -> Identity (a, b) Source # mzipWith :: (a -> b -> c) -> Identity a -> Identity b -> Identity c Source # munzip :: Identity (a, b) -> (Identity a, Identity b) Source #
Show1 Identity # | Since: 4.9.0.0
Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS Source #
Read1 Identity # | Since: 4.9.0.0
Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Identity a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a] Source #
Ord1 Identity # | Since: 4.9.0.0
Methods liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering Source #
Eq1 Identity # | Since: 4.9.0.0
Methods liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool Source #
Bounded a => Bounded (Identity a) # |
Methods minBound :: Identity a Source # maxBound :: Identity a Source #
Enum a => Enum (Identity a) # |
Methods succ :: Identity a -> Identity a Source # pred :: Identity a -> Identity a Source # toEnum :: Int -> Identity a Source # fromEnum :: Identity a -> Int Source # enumFrom :: Identity a -> [Identity a] Source # enumFromThen :: Identity a -> Identity a -> [Identity a] Source # enumFromTo :: Identity a -> Identity a -> [Identity a] Source # enumFromThenTo :: Identity a -> Identity a -> Identity a -> [Identity a] Source #
Eq a => Eq (Identity a) # |
Methods (==) :: Identity a -> Identity a -> Bool Source # (/=) :: Identity a -> Identity a -> Bool Source #
Floating a => Floating (Identity a) # |
Methods pi :: Identity a Source # exp :: Identity a -> Identity a Source # log :: Identity a -> Identity a Source # sqrt :: Identity a -> Identity a Source # (**) :: Identity a -> Identity a -> Identity a Source # logBase :: Identity a -> Identity a -> Identity a Source # sin :: Identity a -> Identity a Source # cos :: Identity a -> Identity a Source # tan :: Identity a -> Identity a Source # asin :: Identity a -> Identity a Source # acos :: Identity a -> Identity a Source # atan :: Identity a -> Identity a Source # sinh :: Identity a -> Identity a Source # cosh :: Identity a -> Identity a Source # tanh :: Identity a -> Identity a Source # asinh :: Identity a -> Identity a Source # acosh :: Identity a -> Identity a Source # atanh :: Identity a -> Identity a Source # log1p :: Identity a -> Identity a Source # expm1 :: Identity a -> Identity a Source # log1pexp :: Identity a -> Identity a Source # log1mexp :: Identity a -> Identity a Source #
Fractional a => Fractional (Identity a) # |
Methods (/) :: Identity a -> Identity a -> Identity a Source # recip :: Identity a -> Identity a Source # fromRational :: Rational -> Identity a Source #
Integral a => Integral (Identity a) # |
Methods quot :: Identity a -> Identity a -> Identity a Source # rem :: Identity a -> Identity a -> Identity a Source # div :: Identity a -> Identity a -> Identity a Source # mod :: Identity a -> Identity a -> Identity a Source # quotRem :: Identity a -> Identity a -> (Identity a, Identity a) Source # divMod :: Identity a -> Identity a -> (Identity a, Identity a) Source # toInteger :: Identity a -> Integer Source #
Data a => Data (Identity a) # | Since: 4.9.0.0
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Identity a -> c (Identity a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Identity a) Source # toConstr :: Identity a -> Constr Source # dataTypeOf :: Identity a -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Identity a)) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Identity a)) Source # gmapT :: (forall b. Data b => b -> b) -> Identity a -> Identity a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Identity a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Identity a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Identity a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Identity a -> m (Identity a) Source #
Num a => Num (Identity a) # |
Methods (+) :: Identity a -> Identity a -> Identity a Source # (-) :: Identity a -> Identity a -> Identity a Source # (*) :: Identity a -> Identity a -> Identity a Source # negate :: Identity a -> Identity a Source # abs :: Identity a -> Identity a Source # signum :: Identity a -> Identity a Source # fromInteger :: Integer -> Identity a Source #
Ord a => Ord (Identity a) # |
Methods compare :: Identity a -> Identity a -> Ordering Source # (<) :: Identity a -> Identity a -> Bool Source # (<=) :: Identity a -> Identity a -> Bool Source # (>) :: Identity a -> Identity a -> Bool Source # (>=) :: Identity a -> Identity a -> Bool Source # max :: Identity a -> Identity a -> Identity a Source # min :: Identity a -> Identity a -> Identity a Source #
Read a => Read (Identity a) # | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed Since: 4.8.0.0
Methods readsPrec :: Int -> ReadS (Identity a) Source # readList :: ReadS [Identity a] Source # readPrec :: ReadPrec (Identity a) Source # readListPrec :: ReadPrec [Identity a] Source #
Real a => Real (Identity a) # |
Methods toRational :: Identity a -> Rational Source #
RealFloat a => RealFloat (Identity a) # |
Methods floatRadix :: Identity a -> Integer Source # floatDigits :: Identity a -> Int Source # floatRange :: Identity a -> (Int, Int) Source # decodeFloat :: Identity a -> (Integer, Int) Source # encodeFloat :: Integer -> Int -> Identity a Source # exponent :: Identity a -> Int Source # significand :: Identity a -> Identity a Source # scaleFloat :: Int -> Identity a -> Identity a Source # isNaN :: Identity a -> Bool Source # isInfinite :: Identity a -> Bool Source # isDenormalized :: Identity a -> Bool Source # isNegativeZero :: Identity a -> Bool Source # isIEEE :: Identity a -> Bool Source # atan2 :: Identity a -> Identity a -> Identity a Source #
RealFrac a => RealFrac (Identity a) # |
Methods properFraction :: Integral b => Identity a -> (b, Identity a) Source # truncate :: Integral b => Identity a -> b Source # round :: Integral b => Identity a -> b Source # ceiling :: Integral b => Identity a -> b Source # floor :: Integral b => Identity a -> b Source #
Show a => Show (Identity a) # | This instance would be equivalent to the derived instances of the `Identity` newtype if the `runIdentity` field were removed Since: 4.8.0.0
Methods showsPrec :: Int -> Identity a -> ShowS Source # show :: Identity a -> String Source # showList :: [Identity a] -> ShowS Source #
Ix a => Ix (Identity a) # |
Methods range :: (Identity a, Identity a) -> [Identity a] Source # index :: (Identity a, Identity a) -> Identity a -> Int Source # unsafeIndex :: (Identity a, Identity a) -> Identity a -> Int inRange :: (Identity a, Identity a) -> Identity a -> Bool Source # rangeSize :: (Identity a, Identity a) -> Int Source # unsafeRangeSize :: (Identity a, Identity a) -> Int
IsString a => IsString (Identity a) # |
Methods fromString :: String -> Identity a Source #
Generic (Identity a) # |
Associated Types type Rep (Identity a) :: * -> * Source # Methods from :: Identity a -> Rep (Identity a) x Source # to :: Rep (Identity a) x -> Identity a Source #
Semigroup a => Semigroup (Identity a) # | Since: 4.9.0.0
Methods (<>) :: Identity a -> Identity a -> Identity a Source # sconcat :: NonEmpty (Identity a) -> Identity a Source # stimes :: Integral b => b -> Identity a -> Identity a Source #
Monoid a => Monoid (Identity a) # |
Methods mempty :: Identity a Source # mappend :: Identity a -> Identity a -> Identity a Source # mconcat :: [Identity a] -> Identity a Source #
FiniteBits a => FiniteBits (Identity a) # |
Methods finiteBitSize :: Identity a -> Int Source # countLeadingZeros :: Identity a -> Int Source # countTrailingZeros :: Identity a -> Int Source #
Bits a => Bits (Identity a) # |
Methods (.&.) :: Identity a -> Identity a -> Identity a Source # (.|.) :: Identity a -> Identity a -> Identity a Source # xor :: Identity a -> Identity a -> Identity a Source # complement :: Identity a -> Identity a Source # shift :: Identity a -> Int -> Identity a Source # rotate :: Identity a -> Int -> Identity a Source # zeroBits :: Identity a Source # bit :: Int -> Identity a Source # setBit :: Identity a -> Int -> Identity a Source # clearBit :: Identity a -> Int -> Identity a Source # complementBit :: Identity a -> Int -> Identity a Source # testBit :: Identity a -> Int -> Bool Source # bitSizeMaybe :: Identity a -> Maybe Int Source # bitSize :: Identity a -> Int Source # isSigned :: Identity a -> Bool Source # shiftL :: Identity a -> Int -> Identity a Source # unsafeShiftL :: Identity a -> Int -> Identity a Source # shiftR :: Identity a -> Int -> Identity a Source # unsafeShiftR :: Identity a -> Int -> Identity a Source # rotateL :: Identity a -> Int -> Identity a Source # rotateR :: Identity a -> Int -> Identity a Source # popCount :: Identity a -> Int Source #
Storable a => Storable (Identity a) # |
Methods sizeOf :: Identity a -> Int Source # alignment :: Identity a -> Int Source # peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) Source # pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (Identity a) Source # pokeByteOff :: Ptr b -> Int -> Identity a -> IO () Source # peek :: Ptr (Identity a) -> IO (Identity a) Source # poke :: Ptr (Identity a) -> Identity a -> IO () Source #
Generic1 * Identity # |
Associated Types type Rep1 Identity (f :: Identity -> *) :: k -> * Source # Methods from1 :: f a -> Rep1 Identity f a Source # to1 :: Rep1 Identity f a -> f a Source #
type Rep (Identity a) # |
type Rep (Identity a) = D1 * (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 * (MetaCons "Identity" PrefixI True) (S1 * (MetaSel (Just Symbol "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a)))
type Rep1 * Identity # |
type Rep1 * Identity = D1 * (MetaData "Identity" "Data.Functor.Identity" "base" True) (C1 * (MetaCons "Identity" PrefixI True) (S1 * (MetaSel (Just Symbol "runIdentity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))