Elm Exactly

Basis entryBasics.identity

A value of Basics. Its type is in Section C.3 Basics.

Static basis

var ↦ (σ,is)identity ↦ (∀a. a→a,v)\begin{array}{|rcl|}\hline \var {\ }& \mapsto {\ }& (\sigma, \is)\\\hline \href{/standard/basis/Basics/identity}{\kw{identity}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a}, \isv)\\\hline\end{array}
Figure 39: Static VE\VE of ME0(Basics)\ME_0(\kw{Basics}): Floating-point Functions and Function Helpers

Dynamic basis

var or con ↦ varityidentity, always, never ↦ Elm\begin{array}{|rclc|}\hline \var\ \text{or}\ \con {\ }& \mapsto {\ }& v {\qquad}& \arity\\\hline \href{/standard/basis/Basics/identity}{\kw{identity}},\ \href{/standard/basis/Basics/always}{\kw{always}},\ \href{/standard/basis/Basics/never}{\kw{never}} {\ }& \mapsto {\ }& \text{Elm} {\qquad}& \\\hline\end{array}
Figure 45: Dynamic VE\VE of ME0(Basics)\ME_0(\kw{Basics})

Its text in Elm

identity x =
  x
Figure 48: The Values of Basics Written in Elm
Read it in its chapter·Permanent address: /standard/basis/Basics/identity

Tests (1)

  • elm-core / BasicsIdentityTest
    `identity` returns its argument unchanged for an Int and a String, and `always 99` returns 99 whatever its second argument.

Discussions

Discuss this basis entry·Search the discussions on GitHub

Discussions are on GitHub; one about this basis entry has [b:Basics.identity] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.