Set-Theoretic Types for Polymorphic Variants - CNRS - Centre national de la recherche scientifique Accéder directement au contenu
Communication Dans Un Congrès Année : 2016

Set-Theoretic Types for Polymorphic Variants

Résumé

Polymorphic variants are a useful feature of the OCaml language whose current definition and implementation rely on kinding constraints to simulate a subtyping relation via unification. This yields an awkward formalization and results in a type system whose behaviour is in some cases unintuitive and/or unduly restrictive. In this work, we present an alternative formalization of poly-morphic variants, based on set-theoretic types and subtyping, that yields a cleaner and more streamlined system. Our formalization is more expressive than the current one (it types more programs while preserving type safety), it can internalize some meta-theoretic properties , and it removes some pathological cases of the current implementation resulting in a more intuitive and, thus, predictable type system. More generally, this work shows how to add full-fledged union types to functional languages of the ML family that usually rely on the Hindley-Milner type system. As an aside, our system also improves the theory of semantic subtyping, notably by proving completeness for the type reconstruction algorithm.
Fichier principal
Vignette du fichier
icfp16-hal.pdf (569.28 Ko) Télécharger le fichier
main.pdf (576.79 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)
Origine : Fichiers produits par l'(les) auteur(s)
Loading...

Dates et versions

hal-01325644 , version 1 (03-06-2016)
hal-01325644 , version 2 (04-07-2016)

Licence

Paternité

Identifiants

Citer

Giuseppe Castagna, Tommaso Petrucciani, Kim Nguyen. Set-Theoretic Types for Polymorphic Variants. ACM SIGPLAN International Conference on Functional Programming, Sep 2016, Nara, Japan. ⟨10.1145/2951913.2951928⟩. ⟨hal-01325644v2⟩
480 Consultations
349 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More