Lower Your Guards: A Compositional Pattern-Match Coverage Checker
summary
Pattern-match coverage checking becomes a desugaring to guard trees that reduce all patterns to three constructs, with two simple processors A and U producing annotated trees and a refinement-type uncovered set. Implemented in GHC, it fixes several of the 28 open tickets, handles exponential-case blowups (16 combos in an example) by bailing out sensibly, generates concrete inhabitants like Just True and Just False via an ad-hoc generator, and yields simpler, faster, and more accurate warnings.
AI-written summary · about
chapters (8)
- 0:00Intro
- 1:17Pattern Match Warnings IRL
- 3:32Inhabitation and strict constructor fields
- 4:52Mixing pattern matching and pattern guards
- 7:04Desugar pattern matching to guard trees
- 10:18Example
- 10:52Computing the uncovered set
- 11:47Reporting uncovered patterns
related talks
16mWe’ve Got You Covered: Type-Guided Repair of Incomplete Input Generators
29mType Inference Techniques: Implementation and Formalization, Better Together
48mAnti-Patterns in the Wild
22mTowards general white-box automation: a typeclass-guided context cleaner
42mSuggesting Valid Substitutions For Typed Holes
51mAutomate More Code With Scalameta
06mKudzu (Lightning Talk)
24mCode Generation via Meta-programming in Dependently Typed Proof Assistants
