Advertisement

Type classes in Haskell

  • Cordelia HallEmail author
  • Kevin HammondEmail author
  • Simon Peyton JonesEmail author
  • Philip WadlerEmail author
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 788)

Abstract

This paper defines a set of type inference rules for resolving over-loading introduced by type classes. Programs including type classes are transformed into ones which may be typed by the Hindley-Milner inference rules. In contrast to other work on type classes, the rules presented here relate directly to user programs. An innovative aspect of this work is the use of second-order lambda calculus to record type information in the program.

Keywords

Inference Rule Target Language Type Class Functional Programming Lambda Calculus 
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.

References

  1. [Aug93]
    L. Augustsson, Implementing Haskell Overloading. In Functional Programming and Computer Architecture, Copenhagen, June 1993.Google Scholar
  2. [Blo91]
    S. Blott, Type classes. Ph.D. Thesis, Glasgow University, 1991.Google Scholar
  3. [CHO92]
    K. Chen, P. Hudak, and M. Odersky, Parametric Type Classes. In Lisp and Functional Programming, 1992, pp. 170–181.Google Scholar
  4. [CW90]
    G. V. Comack and A. K. Wright, Type dependent parameter inference. In Programming Language Design and Implementation, White Plains, New York, June 1990, ACM Press.Google Scholar
  5. [HaBl89]
    K. Hammond and S. Blott, Implementing Haskell Type Classes. In 1989 Glasgow Workshop on Functional Programming, Fraserburgh, Scotland, September 1989, Springer-Verlag WICS, pp. 266–286.Google Scholar
  6. [HaHaPJW]
    C.V. Hall, K. Hammond, S.L.Peyton Jones and P. Wadler, Type Classes In Haskell. Department of Computing Science, Glasgow University, Jan 1994.Google Scholar
  7. [Hue 90]
    Gerard Huet, editor, Logical Foundations of Functional Programming, Addison Wesley, 1990. See Part II, Polymorphic Lambda Calculus, especially the introduction by Reynolds.Google Scholar
  8. [Jon92a]
    M. P. Jones, A theory of qualified types. In European Symposium on Programming, Rennes, February 1992, LNCS 582, Springer-Verlag.Google Scholar
  9. [Jon92b]
    M. P. Jones, Efficient Implementation of Type Class Overloading. Dept. of Computing Science, Oxford University.Google Scholar
  10. [Jon93]
    M. P. Jones, A System of Constructor Classes: Overloading and Implicit Higher-Order Polymorphism. In Functional Programming and Computer Architecture, Copenhagen, June 1993, pp. 52–61.Google Scholar
  11. [Kae88]
    S. Kaes, Parametric polymorphism. In European Symposium on Programming, Nancy, France, March 1988, LNCS 300, Springer-Verlag.Google Scholar
  12. [Läu92]
    Polymorphic Type Inference and Abstract Data Types. K. Läufer, Ph.D. Thesis, New York University, 1992.Google Scholar
  13. [Läu93]
    An Extension of Haskell with First-Class Abstract Types. K. Läufer, Technical Report, Loyola University of Chicago, 1993.Google Scholar
  14. [MTH90]
    R. Milner, M. Tofte, and R. Harper, The definition of Standard ML, MIT Press, Cambridge, Massachusetts, 1990.Google Scholar
  15. [MT91]
    R. Milner and M. Tofte, Commentary on Standard ML, MIT Press, Cambridge, Massachusetts, 1991.Google Scholar
  16. [Mil78]
    R. Milner, A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 1978, pp. 348–375.Google Scholar
  17. [NP93]
    T. Nipkow and C. Prehofer, Type Checking Type Classes. In ACM Symposium on Principles of Programming Languages, January 1993, pp. 409–418.Google Scholar
  18. [NS91]
    T. Nipkow and G. Snelting, Type Classes and Overloading Resolution via Order-Sorted Unification. In Functional Programming Languages and Computer Architecture, Boston, August 1991, LNCS 523, Springer-Verlag.Google Scholar
  19. [OdLä91]
    M. Odersky and K. Läufer, Type classes are signatures of abstract types. Technical Report, IBM TJ Watson Research Centre, May 1991.Google Scholar
  20. [PW91]
    S. L. Peyton Jones and P. Wadler, A static semantics for Haskell. Department of Computing Science, Glasgow University, May 1991.Google Scholar
  21. [Rou90]
    F. Rouaix, Safe run-time overloading. In ACM Symposium on Principles of Programming Languages, San Francisco, January 1990, ACM Press.Google Scholar
  22. [Tur85]
    D. A. Turner, Miranda: A non-strict functional language with polymorphic types. In Functional Programming Languages and Computer Architecture, Nancy, France, September 1985, LNCS 201, Springer-Verlag, pp. 1–16.Google Scholar
  23. [VS91]
    D. M. Volpano and G. S. Smith, On the complexity of ML typability with overloading. In Functional Programming Languages and Computer Architecture, Boston, August 1991, LNCS 523, Springer-Verlag.Google Scholar
  24. [Wad92]
    P. L. Wadler, The essence of functional programming. In ACM Symposium on Principles of Programming Languages, Albuquerque, New Mexico, January 1992.Google Scholar
  25. [WB89]
    P. L. Wadler and S. Blott, How to make ad-hoc polymorphism less ad hoc, In ACM Symposium on Principles of Programming Languages, Austin, Texas, January 1989, pp. 60–76.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1994

Authors and Affiliations

  1. 1.Computing Science DeptGlasgow UniversityGlasgowScotland

Personalised recommendations