Revisiting pattern match overlap checks in Haskell

How hard can it be to spot missing or overlapping patterns in a Haskell function definition? Surely it’s the least we can expect from a decent compiler? But when you mix in GADTs, pattern guards, view patterns, data families, strict data constructors, and pattern synonyms, matters get surprisingly tricky.

the 2015 paper “GADTs meet their match” explored a nice, modular account of pattern-match checking that addresses many of these tricky points. Alas, GHC’s implementation of that paper has proved less than satisfactory: it can be terribly slow and misses cases that programmers think look obvious. So Simon and his colleague Sebastian Graf have been radically refactoring the implementation.

In this talk, Simon will give lots of tricky examples of pattern matching, describe how to think about coverage and overlap checking and reflect on how their new refactored implementation works.