Polytypic Values Possess Polykinded Types
- Cite this paper as:
- Hinze R. (2000) Polytypic Values Possess Polykinded Types. In: Backhouse R., Oliveira J.N. (eds) Mathematics of Program Construction. MPC 2000. Lecture Notes in Computer Science, vol 1837. Springer, Berlin, Heidelberg
A polytypic value is one that is defined by induction on the structure of types. In Haskell types are assigned so-called kinds that distinguish between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to polytypic programming were restricted in that they only allowed to parameterize values by types of one fixed kind. In this paper we show how to define values that are indexed by types of arbitrary kinds. It turns out that these polytypic values possess types that are indexed by kinds. We present several examples that demonstrate that the additional flexibility is useful in practice. One paradigmatic example is the mapping function, which describes the functorial action on arrows. A single polytypic definition yields mapping functions for datatypes of arbitrary kinds including first- and higher-order functors. Polytypic values enjoy polytypic properties. Using kind-indexed logical relations we prove among other things that the polytypic mapping function satisfies suitable generalizations of the functorial laws.
Unable to display preview. Download preview PDF.