A lean specification for GADTs: system F with first-class equality proofs

Generalized Algebraic Data Types are a generalization of Algebraic Data Types with additional type equality constraints. These found their use in many functional programs, including the development of embedded domain specific programming languages and generic programming.Recently, several authors published novel inference algorithms and corresponding type system specifications. These approaches tend to be more algorithmic than declarative in nature, and tied to a given compiler infrastructure. This results in complex specifications. For a language implementor, adopting such a complex approach is hard, due to conflicting infrastructure and language features. Similarly, type inference is difficult to comprehend for a programmer when the specification is complex.To make the integration of GADTs in languages easier, we thus need a more orthogonal specification. We present an orthogonal specification for GADTs: the language System F∼, consisting of System F augmented with first-class equality proofs. This specification exploits the Church encoding of data types to describe GADT matches in terms of conventional lambda abstractions.

[1]  S. Doaitse Swierstra,et al.  The architecture of the Utrecht Haskell compiler , 2009, Haskell.

[2]  Michael J. Maher Herbrand constraint abduction , 2005, 20th Annual IEEE Symposium on Logic in Computer Science (LICS' 05).

[3]  Peter J. Stuckey,et al.  Type Inference for Guarded Recursive Data Types , 2005, ArXiv.

[4]  S. Doaitse Swierstra,et al.  Typed transformations of typed abstract syntax , 2009, TLDI '09.

[5]  Johan Jeuring,et al.  Libraries for Generic Programming in Haskell , 2008, Advanced Functional Programming.

[6]  Peter J. Stuckey,et al.  A Framework for Extended Algebraic Data Types , 2006, FLOPS.

[7]  S. Doaitse Swierstra,et al.  A Leaner Specification for GADTs , 2008, Trends in Functional Programming.

[8]  Torben Æ. Mogensen Efficient self-interpretation in lambda calculus , 1992, Journal of Functional Programming.

[9]  Simon Peyton Jones,et al.  Wobbly types: type inference for generalised algebraic data types∗ , 2004 .

[10]  Simon L. Peyton Jones,et al.  System F with type equality coercions , 2007, TLDI '07.

[11]  S. Doaitse Swierstra,et al.  Typing dynamic typing , 2002, ICFP '02.

[12]  Simon L. Peyton Jones,et al.  Complete and decidable type inference for GADTs , 2009, ICFP.

[13]  Tim Sheard,et al.  Pointwise generalized algebraic data types , 2010, TLDI '10.

[14]  Peter J. Stuckey,et al.  Type inference for GADTs via Herbrand constraint abduction , 2008 .

[15]  Atze Dijkstra Stepping through Haskell , 2000 .

[16]  Yann Régis-Gianas,et al.  Stratified type inference for generalized algebraic data types , 2006, POPL '06.

[17]  James Cheney,et al.  First-Class Phantom Types , 2003 .

[18]  Simon L. Peyton Jones,et al.  Boxy types: inference for higher-rank types and impredicativity , 2006, ICFP '06.

[19]  Pawel Urzyczyn Positive Recursive Type Assignment , 1996, Fundam. Informaticae.

[20]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.