Bidirectional Higher-Rank Polymorphism with Intersection and Union Types
Shengyi Jiang, Chen Cui, Bruno C. d. S. Oliveira
Abstract
Modern mainstream programming languages, such as TypeScript, Flow, and Scala, have polymorphic type systems enriched with intersection and union types. These languages implement variants of bidirectional higher-rank polymorphic type inference, which was previously studied mostly in the context of functional programming. However, existing type inference implementations lack solid theoretical foundations when dealing with non-structural subtyping and intersection and union types, which were not studied before.
In this paper, we study bidirectional higher-rank polymorphic type inference with explicit type applications, and intersection and union types and demonstrate that these features have non-trivial interactions. We first present a type system, described by a bidirectional specification, with good theoretical properties and a sound, complete, and decidable algorithm. This is helpful to identify a class of types that can always be inferred. We also explore variants incorporating practical features, such as handling records and inferring a larger class of types, which align better with real-world implementations. Though some variants no longer have a complete algorithm, they still enhance the expressiveness of the type system. To ensure rigor, all results are formalized in the Coq proof assistant.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 1c527916-6fdc-4712-8363-e7749498a73fCited by top-tier papers1
Ask how each one uses itBuilds on6
- MLstruct: principal type inference in a Boolean algebra of structural typesLionel Parreaux, Chun Yin ChauOOPSLA 2022 · 31 citations
- When Subtyping Constraints Liberate: A Novel Type Inference Approach for First-Class PolymorphismLionel Parreaux, Aleksander Boruch-Gruszecki, Andong Fan, Chun Yin ChauPOPL 2024 · 13 citations
- FreezeML: complete and easy type inference for first-class polymorphismFrank Emrich, Sam Lindley, Jan Stolarek, James Cheney et al.PLDI 2020 · 13 citations
- Polymorphic Type Inference for Dynamic LanguagesGiuseppe Castagna, Mickaël Laurent, Kim NguyenPOPL 2024 · 12 citations
- A Bowtie for a Beast: Overloading, Eta Expansion, and Extensible Data Types in F⋈Nick Rioux, Xuejing Huang, Bruno C. d. S. Oliveira, Steve ZdancewicPOPL 2023 · 10 citations
Related papers
- Greedy Implicit Bounded QuantificationChen Cui, Shengyi Jiang, Bruno C. d. S. OliveiraOOPSLA 2023 · 9 citations
- The Simple Essence of Boolean-Algebraic Subtyping: Semantic Soundness for Algebraic Union, Intersection, Negation, and Equi-recursive TypesChun Yin Chau, Lionel ParreauxPOPL 2026 · 4 citations
- Resolution as intersection subtyping via Modus PonensKoar Marntirosian, Tom Schrijvers, Bruno C. d. S. Oliveira, Georgios KarachaliasOOPSLA 2020 · 5 citations
- A case for DOT: theoretical foundations for objects with pattern matching and GADT-style reasoningAleksander Boruch-Gruszecki, Radoslaw Wasko, Yichen Xu, Lionel ParreauxOOPSLA 2022 · 4 citations
- Merging Gradual TypingWenjia Ye, Bruno C. d. S. Oliveira, Matías ToroOOPSLA 2024 · 2 citations
