Polymorphic types and effects with Boolean unification
Magnus Madsen, Jaco van de Pol
Abstract
We present a simple, practical, and expressive type and effect system based on Boolean constraints. The effect system extends the Hindley-Milner type system, supports parametric polymorphism, and preserves principal types modulo Boolean equivalence. We show how to support type inference by extending Algorithm W with Boolean unification based on the successive variable elimination algorithm. We implement the type and effect system in the Flix programming language. We perform an in-depth evaluation on the impact of Boolean unification on type inference time and end-to-end compilation time. While the computational complexity of Boolean unification is NP-hard, the experimental results demonstrate that it works well in practice. We find that the impact on type inference time is on average a 1.4x slowdown and the overall impact on end-to-end compilation time is a 1.1x slowdown.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Cited by top-tier papers4
- Relational nullable types with Boolean unificationMagnus Madsen, Jaco van de PolOOPSLA 2021 · 9 citations
- Fast and Efficient Boolean Unification for Hindley-Milner-Style Type and Effect SystemsMagnus Madsen, Jaco van de Pol, Troels HenriksenOOPSLA 2023 · 5 citations
- 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
- Qualified Types with Boolean AlgebrasEdward Lee, Jonathan Lindegaard Starup, Ondrej Lhoták, Magnus MadsenOOPSLA 2025 · 1 citation
Related papers
- Associated Effects: Flexible Abstractions for Effectful ProgrammingMatthew Lutze, Magnus MadsenPLDI 2024 · 9 citations
- Let Generalization, Polymorphic Recursion, and Variable Minimization in Boolean-Kinded Type SystemsJoseph A. ZulloPOPL 2026 · 1 citation
- FreezeML: complete and easy type inference for first-class polymorphismFrank Emrich, Sam Lindley, Jan Stolarek, James Cheney et al.PLDI 2020 · 13 citations
- Flix: A Design for Language-Integrated DatalogMagnus Madsen, Ondrej LhotákOOPSLA 2025
- Fixpoints for the masses: programming with first-class Datalog constraintsMagnus Madsen, Ondrej LhotákOOPSLA 2020 · 22 citations
