GADTs have proven to be an invaluable language extension, a.o. for ensuring data invariants and program correctness. Unfortunately, they pose a tough problem for type inference: we lose the principal-type property, which is necessary for modular type inference. We present a novel and simplified type inference approach for local type assumptions from GADT pattern matches. Our approach is complete and decidable, while more liberal than previous such approaches. Categories and Subject Descriptors D.3.2 [Programming Languages]: Language Classifications--Functional Languages; F.3.3 [Logics and Meanings of Programs]: Studies of Program Constructs-Type Structure General Terms Algorithms, Languages Keywords Haskell, type inference, GADTs
Tom Schrijvers, Simon L. Peyton Jones, Martin Sulz