| 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 sis an abbreviation forStateT s.Identity
Since: 4.8.0.0
Synopsis
- newtype Identity a = Identity {
- runIdentity :: a
Documentation
Identity functor and monad. (a non-strict monad)
Since: 4.8.0.0
Instances
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
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
This instance would be equivalent to the derived instances of the
Identity newtype if the runIdentity field were removed
This instance would be equivalent to the derived instances of the
Identity newtype if the runIdentity field were removed