Lune

POPL2024Top-tier venue

When Subtyping Constraints Liberate: A Novel Type Inference Approach for First-Class Polymorphism

Lionel Parreaux, Aleksander Boruch-Gruszecki, Andong Fan, Chun Yin Chau

Abstract

Type inference in the presence of first-class or “ impredicative ” second-order polymorphism à la System F has been an active research area for several decades, with original works dating back to the end of the 80s. Yet, until now many basic problems remain open, such as how to type check expressions like ( λ x . ( x 123 , x True ) ) id reliably. We show that a type inference approach based on multi-bounded polymorphism , a form of implicit polymorphic subtyping with multiple lower and upper bounds, can help us resolve most of these problems in a uniquely simple and regular way. We define F ≤ , a declarative type system derived from the existing theory of implicit coercions by Cretin and Rémy (LICS 2014), and we introduce SuperF, a novel algorithm to infer polymorphic multi-bounded F ≤ types while checking user type annotations written in the syntax of System F. We use a recursion-avoiding heuristic to guarantee termination of type inference at the cost of rejecting some valid programs, which thankfully rarely triggers in practice. We show that SuperF is vastly more powerful than all first-class-polymorphic type inference systems proposed so far, significantly advancing the state of the art in type inference for general-purpose programming languages.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

7 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • A Lightweight Type-and-Effect System for Invalidation Safety: Tracking Permanent and Temporary Invalidation with Constraint-Based Subtype Inference cites MLstruct: principal type inference in a Boolean algebra of structural types
  • A Lightweight Type-and-Effect System for Invalidation Safety: Tracking Permanent and Temporary Invalidation with Constraint-Based Subtype Inference cites Greedy Implicit Bounded Quantification
  • A Lightweight Type-and-Effect System for Invalidation Safety: Tracking Permanent and Temporary Invalidation with Constraint-Based Subtype Inference cites Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type Inference
  • A Lightweight Type-and-Effect System for Invalidation Safety: Tracking Permanent and Temporary Invalidation with Constraint-Based Subtype Inference cites Practical Type Inference with Levels
  • Bidirectional Higher-Rank Polymorphism with Intersection and Union Types cites MLstruct: principal type inference in a Boolean algebra of structural types
  • Bidirectional Higher-Rank Polymorphism with Intersection and Union Types cites Greedy Implicit Bounded Quantification
  • Bidirectional Higher-Rank Polymorphism with Intersection and Union Types cites FreezeML: complete and easy type inference for first-class polymorphism
  • Greedy Implicit Bounded Quantification cites MLstruct: principal type inference in a Boolean algebra of structural types
  • Type Inference for Functional and Imperative Dynamic Languages cites MLstruct: principal type inference in a Boolean algebra of structural types
  • Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type Inference cites MLstruct: principal type inference in a Boolean algebra of structural types
  • Practical Type Inference with Levels cites FreezeML: complete and easy type inference for first-class polymorphism
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers7

  1. Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type InferenceIshan Bhanuka, Lionel Parreaux, David Binder, Jonathan Immanuel BrachthäuserOOPSLA 2023 · 12 citations
  2. A Lightweight Type-and-Effect System for Invalidation Safety: Tracking Permanent and Temporary Invalidation with Constraint-Based Subtype InferenceCunyuan Gao, Lionel ParreauxOOPSLA 2025 · 4 citations
  3. Practical Type Inference with LevelsAndong Fan, Han Xu, Ningning XiePLDI 2025 · 3 citations
  4. Bidirectional Higher-Rank Polymorphism with Intersection and Union TypesShengyi Jiang, Chen Cui, Bruno C. d. S. OliveiraPOPL 2025 · 2 citations
  5. Type Inference for Functional and Imperative Dynamic LanguagesMickaël Laurent, Jan VitekOOPSLA 2026 · 1 citation

Builds on5

  1. MLstruct: principal type inference in a Boolean algebra of structural typesLionel Parreaux, Chun Yin ChauOOPSLA 2022 · 31 citations
  2. FreezeML: complete and easy type inference for first-class polymorphismFrank Emrich, Sam Lindley, Jan Stolarek, James Cheney et al.PLDI 2020 · 13 citations
  3. Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type InferenceIshan Bhanuka, Lionel Parreaux, David Binder, Jonathan Immanuel BrachthäuserOOPSLA 2023 · 12 citations
  4. Greedy Implicit Bounded QuantificationChen Cui, Shengyi Jiang, Bruno C. d. S. OliveiraOOPSLA 2023 · 9 citations
  5. 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

Related papers

  1. Local Contextual Type InferenceXu Xue, Chen Cui, Shengyi Jiang, Bruno C. d. S. OliveiraPOPL 2026
  2. Qualifying System F<: Some Terms and Conditions May ApplyEdward Lee, Yaoyu Zhao, Ondrej Lhoták, James You et al.OOPSLA 2024 · 2 citations
  3. Recursive Subtyping for AllLitao Zhou, Yaoda Zhou, Bruno C. d. S. OliveiraPOPL 2023 · 8 citations
  4. Polymorphic Type Inference for Dynamic LanguagesGiuseppe Castagna, Mickaël Laurent, Kim NguyenPOPL 2024 · 12 citations
  5. Principal Type Inference under a Prefix: A Fresh Look at Static OverloadingDaan Leijen, Wenjia YePLDI 2025 · 2 citations
Dusk over the sea between two cliffs drawn in fine vertical lines