Sums of Uncertainty: Refinements Go Gradual
Khurram A. Jafery, Jana Dunfield

TL;DR
This paper introduces a gradual sum type system combining refinement types with imprecision, ensuring pattern-matching failures are eliminated in statically typed functional languages while supporting incremental typing.
Contribution
It develops a bidirectional type system for gradual sums with refinement types, providing formal guarantees and a translation to explicit casts, advancing gradual typing theory.
Findings
Static sublanguage guarantees no match failures
Less precise annotations preserve well-typedness
Reduced precision delays failure detection
Abstract
A long-standing shortcoming of statically typed functional languages is that type checking does not rule out pattern-matching failures (run-time match exceptions). Refinement types distinguish different values of datatypes; if a program annotated with refinements passes type checking, pattern-matching failures become impossible. Unfortunately, refinement is a monolithic property of a type, exacerbating the difficulty of adding refinement types to nontrivial programs. Gradual typing has explored how to incrementally move between static typing and dynamic typing. We develop a type system of gradual sums that combines refinement with imprecision. Then, we develop a bidirectional version of the type system, which rules out excessive imprecision, and give a type-directed translation to a target language with explicit casts. We prove that the static sublanguage cannot have match failures,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
