A Framework for Extended Algebraic Data Types

  • Martin Sulzmann
  • Jeremy Wazny
  • Peter J. Stuckey
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3945)


There are a number of extended forms of algebraic data types such as type classes with existential types and generalized algebraic data types. Such extensions are highly useful but their interaction has not been studied formally so far. Here, we present a unifying framework for these extensions. We show that the combination of type classes and generalized algebraic data types allows us to express a number of interesting properties which are desired by programmers. We support type checking based on a novel constraint solver. Our results show that our system is practical and greatly extends the expressive power of languages such as Haskell and ML.


Functional Dependency Type Class Typing Rule Type Inference Type Check 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Abdennadher, S.: Operational semantics and confluence of constraint propagation rules. In: Smolka, G. (ed.) CP 1997. LNCS, vol. 1330, pp. 252–266. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  2. Barras, B., Boutin, S., Cornes, C., Courant, J., Filliâtre, J.-C., Herbelin, H., Huet, G., Manoury, P., Muñoz, C., Murthy, C., Parent, C., Paulin- Mohring, C., Saïbi, A., Werner, B.: The Coq Proof Assistant Reference Manual Version 6.1. INRIA-Rocquencourt-CNRS-ENS Lyon (December 1996)Google Scholar
  3. Cheney, J., Hinze, R.: First-class phantom types. Technical Report CUCIS TR2003-1901, Cornell University (2003)Google Scholar
  4. Chakravarty, M., Keller, G., Peyton Jones, S.: Associated types synonyms. In: Proc. of ICFP 2005, pp. 241–253. ACM Press, New York (2005)Google Scholar
  5. Chen, C., Xi, H.: Combining programming with theorem proving. In: Proc. of ICFP 2005, pp. 66–77. ACM Press, New York (2005)Google Scholar
  6. Duck, G.J., Peyton-Jones, S., Stuckey, P.J., Sulzmann, M.: Sound and decidable type inference for functional dependencies. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 49–63. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  7. Frühwirth, T.: Constraint handling rules. In: Montanari, U., Rossi, F. (eds.) CP 1995. LNCS, vol. 976, Springer, Heidelberg (1995)Google Scholar
  8. Glasgow haskell compiler home page,
  9. Jones, S.J., Jones, M.P., Meijer, E.: Type classes: an exploration of the design space. In: Haskell Workshop (June 1997)Google Scholar
  10. Jones, M.P.: Qualified Types: Theory and Practice. D. Phil. thesis, Oxford University, Oxford (1992)Google Scholar
  11. Jones, M.P.: Simplifying and improving qualified types. In: FPCA 1995: Conference on Functional Programming Languages and Computer Architecture. ACM Press, New York (1995)Google Scholar
  12. Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, p. 230. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  13. Läufer, K.: Type classes with existential types. Journal of Functional Programming 6(3), 485–517 (1996)MathSciNetCrossRefMATHGoogle Scholar
  14. Lassez, J., Maher, M., Marriott, K.: Unification revisited. In: Foundations of Deductive Databases and Logic Programming. Morgan Kauffman, San Francisco (1987)Google Scholar
  15. Läufer, K., Odersky, M.: Polymorphic type inference and abstract data types. ACM Trans. Program. Lang. Syst. 16(5), 1411–1430 (1994)CrossRefGoogle Scholar
  16. Nilsson, H.: Dynamic optimization for functional reactive programming using generalized algebraic data types. In: Proc. of ICFP 2005, pp. 54–65. ACM Press, New York (2005)Google Scholar
  17. Odersky, M., Sulzmann, M., Wehr, M.: Type inference with constrained types. Theory and Practice of Object Systems 5(1), 35–55 (1999)CrossRefGoogle Scholar
  18. Jones, S.P., Vytiniotis, D., Washburn, G., Weirich, S.: Simple unification-based type inference for GADTs (2005), Submitted to PLDI 2006Google Scholar
  19. Jones, S.P. (ed.): Haskell 1998 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
  20. Pottier, F., Gauthier, N.: Polymorphic typed defunctionalization. In: Proc. of POPL 2004, pp. 89–98. ACM Press, New York (2004)Google Scholar
  21. Pottier, F., Régis-Gianas, Y.: Stratified type inference for generalized algebraic data types. In: Proc. of POPL 2006, pp. 232–244. ACM Press, New York (2006)Google Scholar
  22. Pfenning, F., Schürmann, C.: System description: Twelf - a metalogical framework for deductive systems. In: Ganzinger, H. (ed.) CADE 1999. LNCS (LNAI), vol. 1632, pp. 202–206. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  23. Sheard, T.: Putting curry-howard to work. In: Proc. of Haskell 2005, pp. 74–85. ACM Press, New York (2005)Google Scholar
  24. Shoenfield, J.R.: Mathematical Logic. Addison-Wesley, Reading (1967)MATHGoogle Scholar
  25. Sheard, T., Pasalic, E.: Meta-programming with built-in type equality. In: Fourth International Workshop on Logical Frameworks and Meta-Languages (2004)Google Scholar
  26. Simonet, V., Pottier, F.: Constraint-based type inference for guarded algebraic data types. Research Report 5462, INRIA (January 2005)Google Scholar
  27. Stuckey, P.J., Sulzmann, M.: A theory of overloading. ACM Transactions on Programming Languages and Systems (2005) (to appear)Google Scholar
  28. Sulzmann, M.: A General Framework for Hindley/Milner Type Systems with Constraints. PhD thesis, Yale University, Department of Computer Science (May 2000)Google Scholar
  29. Sulzmann, M., Wazny, J.: Chameleon,
  30. Sulzmann, M., Wazny, J.: Lexically scoped type annotations (2005),
  31. Sulzmann, M., Wazny, J., Stuckey, P.J.: Co-induction and type improvement in type class proofs (2005),
  32. Sulzmann, M., Wazny, J., Stuckey, P.J.: A framework for extended algebraic data types. Technical report, The National University of Singapore (2006)Google Scholar
  33. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad-hoc. In: Proc. of POPL 1989, pp. 60–76. ACM Press, New York (1989)Google Scholar
  34. Xi, H., Chen, C., Chen, G.: Guarded recursive datatype constructors. In: Proc. of POPL 2003, pp. 224–235. ACM Press, New York (2003)Google Scholar
  35. Zenger, C.: Indizierte Typen. PhD thesis, Universität Karlsruhe (1999)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Martin Sulzmann
    • 1
  • Jeremy Wazny
    • 3
  • Peter J. Stuckey
    • 2
    • 3
  1. 1.School of ComputingNational University of SingaporeSingapore
  2. 2.NICTA Victoria LaboratoryAustralia
  3. 3.Department of Computer Science and Software EngineeringThe University of MelbourneAustralia

Personalised recommendations