Hostname: page-component-848d4c4894-8bljj Total loading time: 0 Render date: 2024-06-20T13:01:20.234Z Has data issue: false hasContentIssue false

Phantom types and subtyping

Published online by Cambridge University Press:  09 June 2006

MATTHEW FLUET
Affiliation:
Cornell University, Ithaca, NY 14853, USA (e-mail: fluet@cs.cornell.edu)
RICCARDO PUCELLA
Affiliation:
Northeastern University, Boston, MA 02115, USA (e-mail: riccardo@ccs.neu.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We investigate a technique from the literature, called the phantom-types technique, that uses parametric polymorphism, type constraints, and unification of polymorphic types to model a subtyping hierarchy. Hindley-Milner type systems, such as the one found in Standard ML, can be used to enforce the subtyping relation, at least for first-order values. We show that this technique can be used to encode any finite subtyping hierarchy (including hierarchies arising from multiple interface inheritance). We formally demonstrate the suitability of the phantom-types technique for capturing first-order subtyping by exhibiting a type-preserving translation from a simple calculus with bounded polymorphism to a calculus embodying the type system of SML.

Type
Article
Copyright
2006 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.