Reasoning about GADT Pattern Matching in Haskell

3 800
79.2
Опубликовано 21 июня 2016, 23:59
Generalized Algebraic Data Types (GADTs) are a simple but powerful generalization of Algebraic Data Types (ADTs) in Haskell and the ML family. Reasoning about the accessibility of case branches and the exhaustiveness of pattern matching is a well studied and efficiently solved problem for ADTs. However, classic algorithms fall short in the presence of GADTs, issuing false warnings: Since GADT constructors introduce local constraints, we must allow for the fact that particular combinations of patterns and/or values cannot actually occur. We present a novel algorithm for checking pattern matching that accounts for Haskell's laziness and relies on implication constraints generated and solved by the OutsideIn(X) type inference engine. Since we rely on the existing type inference engine, our approach is efficient and robust to future extensions of the type system. We also report on a proof-of-concept implementation of our algorithm in GHC.
Случайные видео
219 дней – 151 8151:52
Highlights | Xiaomi MWC 2024
автотехномузыкадетское