- Parametricity
In the theory of
programming languages incomputer science , parametricity is a theoretical result that states that functions that have types that are related to each other share certain properties in common.Theory of parametricity
The "parametricity theorem" was originally stated by
John C. Reynolds , who called it the "abstraction theorem". [cite conference
first = J.C.
last = Reynolds
title = Types, abstraction, and parametric polymorphism
booktitle = Information Processing
pages = 513-523
year = 1983
location = North Holland, Amsterdam ]In his paper "Theorems for free!" [cite conference
first = Philip
last = Wadler
url = http://citeseer.ist.psu.edu/wadler89theorems.html
title = Theorems for free!
booktitle = 4th Int'l Conf. on Functional Programming and Computer Architecture
date = September 1989
location = London ] ,Philip Wadler described an application of parametricity to derive theorems about parametrically polymorphic functions based on their types.Parametricity and programming language implementation
Parametricity is the basis for many
program transformation s implemented in compilers for theHaskell programming language . These transformations were traditionally thought to be correct in Haskell because of Haskell'snon-strict semantics. Despite being a lazy programming language, Haskell does support certain primitive operations — such as the operatorseq
— that enable so-called "selective strictness", allowing the programmer to force the evaluation of certain expressions. In their paper "Free theorems in the presence of "seq" [cite conference
first = Patricia
last = Johann
coauthors = Janis Voigtlaender
title = Free theorems in the presence of "seq"
url = http://citeseer.ist.psu.edu/johann04free.html
booktitle = Proc., Principles of Programming Languages
date = January 2004
pages = 99-110] ,Patricia Johann andJanis Voigtlaender showed that because of the presence of these operations, the general parametricity theorem does not hold for Haskell programs; thus, these transformations are unsound.See also
*
Parametric polymorphism
*Non-strict programming language References
Wikimedia Foundation. 2010.