Type-level programming with match types

Type-level programming is becoming more and more popular in the realm of functional programming. However, the combination of type-level programming and subtyping remains largely unexplored in practical programming languages. This paper presents match types , a type-level equivalent of pattern matchi...

Full description

Saved in:
Bibliographic Details
Published inProceedings of ACM on programming languages Vol. 6; no. POPL; pp. 1 - 24
Main Authors Blanvillain, Olivier, Brachthäuser, Jonathan Immanuel, Kjaer, Maxime, Odersky, Martin
Format Journal Article
LanguageEnglish
Published 01.01.2022
Online AccessGet full text

Cover

Loading…
More Information
Summary:Type-level programming is becoming more and more popular in the realm of functional programming. However, the combination of type-level programming and subtyping remains largely unexplored in practical programming languages. This paper presents match types , a type-level equivalent of pattern matching. Match types integrate seamlessly into programming languages with subtyping and, despite their simplicity, offer significant additional expressiveness. We formalize the feature of match types in a calculus based on System F sub and prove its soundness. We practically evaluate our system by implementing match types in the Scala 3 reference compiler, thus making type-level programming readily available to a broad audience of programmers.
ISSN:2475-1421
2475-1421
DOI:10.1145/3498698