HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Modulebase-4.23.0.0Haskell2010

Data.Functor.Identity

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.

  • 1 type
  • Packagebase-4.23.0.0
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIdentity.hs
newtypenewtype Identity a
#

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

Examples
Example1 expression
fmap (+1) (Identity 0)Identity 1
Example1 expression
Identity [1, 2, 3] <> Identity [4, 5, 6]Identity [1,2,3,4,5,6]
>>> do
      x <- Identity 10
      y <- Identity (x + 5)
      pure (x + y)
Identity 25

Constructors

Instances37Monad, Functor, MonadFix, Applicative, Foldable, Traversable, …