Type constructors
In the previous chapter we introduced the possibility of constructing generalised terms, by abstracting a term from a type variable. For example, the term λx : σ · x (which is the identity on the fixed type σ) can be generalised to the term λα : * · λ x : α · x (the ‘polymorphic’ identity, i.e. the identity on variable type α, abstracted from this α).
In a similar manner, there is a natural wish to construct generalised types. For example, types like β → β, γ → γ, (γ → β) → (γ → β), …, all have the general structure ◇ → ◇, with the same type both left and right of the arrow. Abstracting over ◇ makes it possible to describe the whole family of types with this structure.
In order to handle this, we introduce a generalised expression that embodies the essence of this structure: λα : * · α → α. This is itself not a type, but a function with a type as a value. It is therefore called a type constructor. Only when we ‘feed’ it with e.g. β, γ or (γ → β), we obtain types:
(λα : * · α → α) β → β β → β,
(λα : * · α → α) γ → β γ → γ,
(λα : * · α → α) (γ → β) → β (γ → β) → (γ → β).