Published online by Cambridge University Press: 05 November 2014
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:
(λα : * · α → α) β → β β → β,
(λα : * · α → α) γ → β γ → γ,
(λα : * · α → α) (γ → β) → β (γ → β) → (γ → β).
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.