In Haskell there is an identity function, that just return the feeded value.
id :: a -> a
There is also the identity functor and how such a functor is defined in Haskell?
Yes, the identity functor exists:
From the documentation:
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.
https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Functor-Identity.html
The definition in the source is here: https://hackage.haskell.org/package/base-4.12.0.0/docs/src/Data.Functor.Identity.html