Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
Type variable

In type theory and programming languages, a type variable is a mathematical variable ranging over types. Even in programming languages that allow mutable variables, a type variable remains an abstraction, in the sense that it does not correspond to some memory locations.

Programming languages that support parametric polymorphism make use of universally quantified type variables. Languages that support existential types make use of existentially quantified type variables. For example, the following OCaml code defines a polymorphic identity function that has a universally quantified type, which is printed by the interpreter on the second line:

# let id x = x;; val id : 'a -> 'a = <fun>

In mathematical notation, the type of the function id is ∀ a . a → a {\displaystyle \forall a.a\to a} , where a {\displaystyle a} is a type variable.

We don't have any images related to Type variable yet.
We don't have any YouTube videos related to Type variable yet.
We don't have any PDF documents related to Type variable yet.
We don't have any Books related to Type variable yet.
We don't have any archived web articles related to Type variable yet.

See also