Abstract
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.
Article PDF
Similar content being viewed by others
Avoid common mistakes on your manuscript.
References
Baars, A.I., Swierstra, S.D.: Typing dynamic typing. In: ICFP, pp. 157–166 (2002)
Baars, A.I., Swierstra, S.D., Viera, M.: Typed transformations of typed abstract syntax. In: Kennedy, A., Ahmed, A. (eds.) TLDI, pp. 15–26. ACM, New York (2009)
Cheney, J., Hinze, R.: First-class phantom types. Tech. rep., Cornell University (2003)
Dijkstra, A.: Stepping through Haskell. PhD thesis, Utrecht University, Department of Information and Computing Sciences (2005). http://www.cs.uu.nl/wiki/Ehc/WebHome, papers/dijkstra05phd.pdf
Dijkstra, A., Fokker, J., Swierstra, S.D.: The architecture of the Utrecht Haskell compiler. In: Weirich, S. (ed.) Haskell, pp. 93–104. ACM, New York (2009)
Jeuring, J., Leather, S., Magalhães, J.P., Yakushev, AR: Libraries for generic programming in Haskell. In: AFP, pp. 165–229 (2008)
Lin, C., Sheard, T.: Pointwise generalized algebraic data types. In: Kennedy, A., Benton, N. (eds.) TLDI, pp. 51–62. ACM, New York (2010)
Maher, M.J.: Herbrand constraint abduction. In: LICS, pp. 397–406. IEEE Computer Society, Washington (2005)
Middelkoop, A., Dijkstra, A., Swierstra, S.D.: A leaner specification for generalized algebraic data types. In: TFP, vol. 9, pp. 65–80 (2008)
Mogensen, T.Æ.: Efficient self-interpretations in lambda calculus. J. Funct. Program. 2(3), 345–363 (1992)
Peyton Jones, S.L., Washburn, G., Weirich, S.: Wobbly types: type inference for generalised algebraic data types. Tech. Rep. MS-CIS-05-26, University of Pennsylvania, Computer and Information Science Department, Levine Hall, 3330 Walnut Street, Philadelphia, Pennsylvania, 19104-6389 (2004)
Peyton Jones, S.L., Vytiniotis, D., Weirich, S., Washburn, G.: Simple unification-based type inference for GADTs. In: ICFP, pp. 50–61 (2006)
Pottier, F., Régis-Gianas, Y.: Stratified type inference for generalized algebraic data types. In: POPL, pp. 232–244 (2006)
Schrijvers, T., Jones, S.L.P., Sulzmann, M., Vytiniotis, D.: Complete and decidable type inference for GADTs. In: ICFP, pp. 341–352 (2009)
Stuckey, P.J., Sulzmann, M.: Type inference for guarded recursive data types. CoRR abs/cs/0507037 (2005)
Sulzmann, M., Schrijvers, T., Stuckey, P.J.: Type inference for GADTs via Herbrand constraint abduction. Manuscript (2006)
Sulzmann, M., Wazny, J., Stuckey, P.J.: A framework for extended algebraic data types. In: FLOPS, pp. 47–64 (2006)
Sulzmann, M., Chakravarty, M.M.T., Peyton Jones, S.L., Donnelly, K.: System F with Type Equality Coercions. In: TLDI, pp. 53–66 (2007)
Urzyczyn, P.: Positive recursive type assignment. Fundam. Inform. 28(1–2), 197–209 (1996)
Vytiniotis, D., Weirich, S., Peyton Jones, S.L.: Boxy types: inference for higher-rank types and impredicativity. In: Reppy, J.H., Lawall, J.L. (eds.) ICFP, pp. 251–262. ACM, New York (2006)
Wazny, J.R.: Type inference and type error diagnosis for Hindley/Milner with extensions. PhD thesis, The university of Melbourne (2006)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Open Access This is an open access article distributed under the terms of the Creative Commons Attribution Noncommercial License (https://creativecommons.org/licenses/by-nc/2.0), which permits any noncommercial use, distribution, and reproduction in any medium, provided the original author(s) and source are credited.
About this article
Cite this article
Middelkoop, A., Dijkstra, A. & Swierstra, S.D. A lean specification for GADTs: system F with first-class equality proofs. Higher-Order Symb Comput 23, 145–166 (2010). https://doi.org/10.1007/s10990-011-9065-0
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10990-011-9065-0