Abstract
GADTs have proven to be an invaluable language extension, for ensuring data invariants and program correctness among others. 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.
Supplemental Material
- J. Cheney and R. Hinze. First-class phantom types. TR 1901, Cornell University, 2003.Google Scholar
- A. Degtyarev and A. Voronkov. Simultaneous regid E-unification is undecidable. In Proc. of CSL'95, volume 1092 of LNCS, pages 178--190. Springer, 1995. Google Scholar
Digital Library
- J. H. Gallier, P. Narendran, S. Raatz, and W. Snyder. Theorem proving using equational matings and rigid e-unification. J. ACM, 39(2):377--429, 1992. Google Scholar
Digital Library
- J. R. Lewis, J. Launchbury, E. Meijer, and M. Shields. Implicit parameters: Dynamic scoping with static types. In POPL, pages 108--118, 2000. Google Scholar
Digital Library
- M. Maher. Herbrand constraint abduction. In Proc. of LICS'05, pages 397--406. IEEE Comp. Soc., 2005. Google Scholar
Digital Library
- F. Pottier and D. Rémy. The essence of ML type inference. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 10, pages 389--489. MIT Press, 2005.Google Scholar
- F. Pottier and Y. Régis-Gianas. Stratified type inference for generalized algebraic data types. In Proc. of POPL'06, pages 232--244. ACM, 2006. Google Scholar
Digital Library
- S. Peyton Jones, D. Vytiniotis, S. Weirich, and M. Shields. Practical type inference for arbitrary-rank types. J. of Func. Prog., 17:1--82, January 2007. Google Scholar
Digital Library
- S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In Proc. of ICFP'06, pages 50--61. ACM, 2006. Google Scholar
Digital Library
- M. Sulzmann, M. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In Proc. of TLDI'07. ACM, 2007. Google Scholar
Digital Library
- T. Schrijvers, S. Peyton Jones, M. Chakravarty, and M. Sulzmann. Type checking with open type functions. SIGPLAN Not., 43(9):51--62, 2008. Google Scholar
Digital Library
- V. Simonet and F. Pottier. A constraint-based approach to guarded algebraic data types. ACM Trans. Prog. Languages Systems, 29(1), January 2007. Google Scholar
Digital Library
- M. Sulzmann, T. Schrijvers, and P. J. Stuckey. Principal type inference for GHC-style multi-parameter type classes. In Proc. of APLAS'06, volume 4279 of LNCS, pages 26--43. Springer, 2006. Google Scholar
Digital Library
- M. Sulzmann, T. Schrijvers, and P. Stuckey. Type inference for GADTs via Herbrand constraint abduction. Report CW 507, K.U.Leuven, Belgium, 2008.Google Scholar
Index Terms
Complete and decidable type inference for GADTs
Recommendations
Simple unification-based type inference for GADTs
Proceedings of the 2006 ICFP conferenceGeneralized algebraic data types (GADTs), sometimes known as "guarded recursive data types" or "first-class phantom types", are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the ...
Principal type inference for GADTs
POPL '16We present a new method for GADT type inference that improves the precision of previous approaches. In particular, our approach accepts more type-correct programs than previous approaches when they do not employ type annotations. A side benefit of our ...
Complete and decidable type inference for GADTs
ICFP '09: Proceedings of the 14th ACM SIGPLAN international conference on Functional programmingGADTs have proven to be an invaluable language extension, for ensuring data invariants and program correctness among others. Unfortunately, they pose a tough problem for type inference: we lose the principal-type property, which is necessary for modular ...







Comments