Phantom Types and Subtyping
Matthew Fluet, Riccardo Pucella
Abstract
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.
Create a lesson
Related papers
Tacet: A Language and Type System for Automatic Statistical Validity Accounting
Chiké Abuah
You may implement this later: Cofunctors as partial implementations
Vincent Wang-Maścianica
Direct Manipulation and Natural Language Programming, Together at Last?
Parker Ziegler, David Minh-Duy Cao, Justin Lubin et al.
A Programming Paradigm for Spatiotemporal Composability
Yifan Shi, Wei Zhang, Tianyi Cui
MGQL: An Executable, Small-Step Semantics of GQL
Aditya Thimmaiah, Tong-Nong Lin, Milos Gligoric
NoC-Out: A Formally-verified Network-on-Chip Library for Rule-based Hardware Designs
Max Kurze, František Farka, Sebastian Ertel