Phantom types and subtyping

@article{Fluet2006PhantomTA,
  title={Phantom types and subtyping},
  author={Matthew Fluet and Riccardo Pucella},
  journal={Journal of Functional Programming},
  year={2006},
  volume={16},
  pages={751 - 791}
}
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… Expand
Practical Datatype Specializations with Phantom Types and Recursion Schemes
TLDR
It is shown that it is possible to express statically-checked specializations within the type system of Standard ML in a way that does not lose useful programming facilities such as pattern matching in case expressions. Expand
Sound and complete bidirectional typechecking for higher-rank polymorphism with existentials and indexed types
TLDR
This work gives a declarative specification of typing based on focalization, allowing for coverage of pattern matching, as well as support for first-class existential types using a focalized subtyping judgment, and extends the declaratives specification with an explicit rules for deducing when a type is principal. Expand
Thesis Proposal: Unifying Principles of Type Refinements
Traditional static type systems in the Hindley-Milner style are a useful means of guaranteeing type safety, in the form of type preservation and progress theorems, and of broadly specifyingExpand
An extensible dynamically-typed hierarchy of exceptions
TLDR
This paper proposes a lightweight solution involving the use of existential types and the Typeable class only, and shows how this solution allows a fully extensible hierarchy of exception types to be declared, in which a single overloaded catch operator can be used to catch either specific exception types, or exceptions belonging to any subclass in the hierarchy. Expand
A unified system of type refinements
TLDR
This work presents a system of type refinements that unifies and extends past work on datasort and index refinements, and provides unified mechanisms of definite types, such as intersections, and indefinite types,such as unions. Expand
Sound and Complete Bidirectional Typechecking for Higher-Rank Polymorphism with Existentials
  • 2018
ANONYMOUS AUTHOR(S) Bidirectional typechecking, in which terms either synthesize a type or are checked against a known type, has become popular for its scalability, its error reporting, and its easeExpand
Dotty Phantom Types
Phantom types are a well-known type-level, design pattern which is commonly used to express constraints encoded in types. We observe that in modern, multi-paradigm programming languages, theseExpand
Sound and Complete Bidirectional Typechecking for Higher-Rank Polymorphism with Existentials and Indexed Types ANONYMOUS
  • 2018
ANONYMOUS AUTHOR(S) Bidirectional typechecking, in which terms either synthesize a type or are checked against a known type, has become popular for its scalability, its error reporting, and its easeExpand
Lightweight Static Capabilities
TLDR
A modular programming style that harnesses modern type systems to verify safety conditions in practical systems and calls for an expressive core language, higher-rank polymorphism, and phantom types is described. Expand
Translating dependency into parametricity
TLDR
It is proved that the parametricity theorem for F implies the noninterference theorem for DCC, and the translation provides insights into DCC's type system and suggests implementation strategies of dependency calculi in polymorphic languages. Expand
...
1
2
3
4
5
...

References

SHOWING 1-10 OF 23 REFERENCES
An Extension of System F with Subtyping
TLDR
The main focus of the paper is the equational theory of F<:, which is related to PER models and the notion of parametricity, and some categorical properties of the theory when restricted to closed terms, including interesting categorical isomorphisms. Expand
Practical Datatype Specializations with Phantom Types and Recursion Schemes
TLDR
It is shown that it is possible to express statically-checked specializations within the type system of Standard ML in a way that does not lose useful programming facilities such as pattern matching in case expressions. Expand
A Theory of Type Polymorphism in Programming
  • R. Milner
  • Computer Science
  • J. Comput. Syst. Sci.
  • 1978
TLDR
This work presents a formal type discipline for polymorphic procedures in the context of a simple programming language, and a compile time type-checking algorithm w which enforces the discipline. Expand
Type inference with polymorphic recursion
The Damas-Milner Calculus is the typed λ-calculus underlying the type system for ML and several other strongly typed polymorphic functional languages such as Miranda and Haskell. Mycroft has extendedExpand
Refinement types for ML
TLDR
A type system called refinement types is described, which is an example of a new way to make this tradeoff, as well as a potentially useful system in itself. Expand
Type reconstruction in the presence of polymorphic recursion
TLDR
It is shown that the typability problem for each one of these extensions of ML is polynomial-time equivalent to the Semi-Unification Problem and, therefore, undecidable. Expand
Type extension through polymorphism
TLDR
A record data type can be extended by addition of more fields, which results in a type hierarchy that can be used in Ada and other languages with generic program units. Expand
No-Longer-Foreign: Teaching an ML compiler to speak C "natively"
TLDR
The core component of this work is an encoding of the almost 2 complete C type system in ML types, taking advantage of ML’s polymorphism, its type constructors, its abstraction mechanisms, and even functors. Expand
Type checking records and variants in a natural extension of ML
TLDR
This work solves the problem of global treatment of record types as a special case by giving an ordinary status to records without any ad hoc assertions, replacing inclusion rules by extra information in record types. Expand
Semantics, Applications, and Implementation of Program Generation
TLDR
A Transformational Approach which Combines Size Inference and Program Optimization is presented, which combines size inference and program Optimization. Expand
...
1
2
3
...