Advertisement

First-Class Type Classes

  • Matthieu Sozeau
  • Nicolas Oury
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5170)

Abstract

Type Classes have met a large success in Haskell and Isabelle, as a solution for sharing notations by overloading and for specifying with abstract structures by quantification on contexts. However, both systems are limited by second-class implementations of these constructs, and these limitations are only overcomed by ad-hoc extensions to the respective systems. We propose an embedding of type classes into a dependent type theory that is first-class and supports some of the most popular extensions right away. The implementation is correspondingly cheap, general and integrates well inside the system, as we have experimented in Coq. We show how it can be used to help structured programming and proving by way of examples.

Keywords

Type Theory Type Class Dependent Type Proof Assistant Proof Search 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Birtwistle, G.M., Dahl, O.-J., Myhrhaug, B., Nygaard, K.: Simula Begin. Studentlitteratur (Lund, Sweden), Bratt Institut fuer neues Lernen (Goch, FRG), Chartwell-Bratt Ltd (Kent, England) (1979)Google Scholar
  2. 2.
    Chakravarty, M.M.T., Keller, G., Jones, S.L.P., Marlow, S.: Associated types with class. In: Palsberg, J., Abadi, M. (eds.) POPL, pp. 1–13. ACM Press, New York (2005)Google Scholar
  3. 3.
    Coquand, T., Pollack, R., Takeyama, M.: A logical framework with dependently typed records. In: Hofmann, M.O. (ed.) TLCA 2003. LNCS, vol. 2701, pp. 105–119. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  4. 4.
    Damas, L., Milner, R.: Principal type schemes for functional programs. In: POPL, Albuquerque, New, Mexico, pp. 207–212 (1982)Google Scholar
  5. 5.
    Grégoire, B., Leroy, X.: A compiled implementation of strong reduction. In: ICFP 2002, pp. 235–246. ACM Press, New York (2002)Google Scholar
  6. 6.
    Haftmann, F., Wenzel, M.: Constructive Type Classes in Isabelle. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 160–174. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  7. 7.
    Huffman, B., Matthews, J., White, P.: Axiomatic Constructor Classes in Isabelle/HOLCF. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 147–162. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  8. 8.
    Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000 and ETAPS 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  9. 9.
    Kahl, W., Scheffczyk, J.: Named instances for haskell type classes. In: Hinze, R. (ed.) A Comparative Study of Very Large Data Bases. LNCS, vol. 59. Springer, Heidelberg (2001)Google Scholar
  10. 10.
    Kammüller, F., Wenzel, M., Paulson, L.C.: Locales - A Sectioning Concept for Isabelle. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Théry, L. (eds.) TPHOLs 1999. LNCS, vol. 1690, pp. 149–166. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  11. 11.
    Letouzey, P.: Programmation fonctionnelle certifie – L’extraction de programmes dans l’assistant Coq. PhD thesis, Universit Paris-Sud (July 2004)Google Scholar
  12. 12.
    Moors, A., Piessens, F., Odersky, M.: Generics of a higher kind. In: ECOOP 2008 (submitted, 2008)Google Scholar
  13. 13.
    Pollack, R.: Dependently typed records for representing mathematical structure. In: Aagaard, M.D., Harrison, J. (eds.) TPHOLs 2000. LNCS, vol. 1869, pp. 462–479. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  14. 14.
    Saïbi, A.: Typing algorithm in type theory with inheritance. In: POPL, La Sorbonne, Paris, France, January 15-17, 1997, pp. 292–301. ACM Press, New York (1997)CrossRefGoogle Scholar
  15. 15.
    Sozeau, M.: Subset coercions in Coq. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 237–252. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  16. 16.
    The Coq Development Team. The Coq Proof Assistant Reference Manual – Version V8.1 (July 2006), http://coq.inria.fr
  17. 17.
    Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: POPL, Austin, Texas, pp. 60–76 (1989)Google Scholar
  18. 18.
    Wenzel, M.: Type classes and overloading in higher-order logic. In: Gunter, E.L., Felty, A.P. (eds.) TPHOLs 1997. LNCS, vol. 1275, pp. 307–322. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  19. 19.
    Wenzel, M., Paulson, L.: Isabelle/isar. In: Wiedijk, F. (ed.) The Seventeen Provers of the World. LNCS (LNAI), vol. 3600, pp. 41–49. Springer, Heidelberg (2006)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Matthieu Sozeau
    • 1
  • Nicolas Oury
    • 2
  1. 1.Univ. Paris Sud, CNRS,Laboratoire LRI, UMR 8623,Orsay, F-91405 INRIA Saclay, ProVal, Parc Orsay UniversitéFrance
  2. 2.University of NottinghamUK

Personalised recommendations