Reasoning about GADT Pattern Matching in Haskell

3 822
79.6
Опубликовано 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.
Случайные видео
213 дней – 14 0290:52
MSI Claw - Hands-On!
24.06.09 – 1 145 2134:51
HTC Hero - First Look
29 дней – 2 8970:45
CSS property: box-decoration-break
автотехномузыкадетское