In programming languages and type theory, **parametric polymorphism** is a way to make a language more expressive, while still maintaining full static type-safety. Using parametric polymorphism, a function or a data type can be written generically so that it can handle values *identically* without depending on their type. Such functions and data types are called **generic functions** and **generic datatypes** respectively and form the basis of generic programming.

For example, a function `append`

that joins two lists can be constructed so that it does not care about the type of elements: it can append lists of integers, lists of real numbers, lists of strings, and so on. Let the *type variable a* denote the type of elements in the lists. Then `append` can be typed ` x -> `, where ` denotes the type of lists with elements of type `*a*. We say that the type of `append` is *parameterized by a* for all values of *a*. (Note that since there is only one type variable, the function cannot be applied to just any pair of lists: the pair, as well as the result list, must consist of the same type of elements.) For each place where `append` is applied, a value is decided for *a*.

Following Christopher Strachey, parametric polymorphism may be contrasted with ad-hoc polymorphism, in which a single polymorphic function can have a number of distinct and potentially heterogeneous implementations depending on the type of argument(s) to which it is applied. Thus, ad-hoc polymorphism can generally only support a limited number of such distinct types, since a separate implementation has to be provided for each type.

Read more about Parametric Polymorphism: History, Bounded Parametric Polymorphism, See Also

### Other articles related to "polymorphism, parametric polymorphism":

... In computer science,

**polymorphism**is a programming language feature that allows values of different data types to be handled using a uniform interface ... The concept of

**parametric polymorphism**applies to both data types and functions ... There are several fundamentally different kinds of

**polymorphism**, two of which were originally informally described by Christopher Strachey in 1967 ...

**Parametric Polymorphism**

...

**Parametric polymorphism**allows a function or a data type to be written generically, so that it can handle values identically without depending on their type ...

**Parametric polymorphism**is a way to make a language more expressive, while still maintaining full static type-safety ...

**Parametric polymorphism**is ubiquitous in functional programming, where it is often simply referred to as "

**polymorphism**" ...