skip to main content
10.1145/155090.155112acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article
Free Access

Implementing type classes

Published:01 June 1993Publication History

ABSTRACT

We describe the implementation of a type checker for the functional programming language Haskell that supports the use of type classes. This extends the type system of ML to support overloading (ad-hoc polymorphism) and can be used to implement features such as equality types and numeric overloading in a simple and general way.

The theory of type classes is well understood, but the practical issues involved in the implementation of such systems have not received a great deal of attention. In addition to the basic type checking algorithm, an implmenentation of type classes also requires some form of program transformation. In all current Haskell compilers this takes the form of dictionary conversion, using functions as hidden parameters to overloaded values. We present efficient techniques for type checking and dictionary conversion. A number of optimizations and extensions to the basic type class sytems are also described.

References

  1. 1.A.W. Appel. A critique of Standard ML. Princeton University CS-TR-364-92, February 1992.Google ScholarGoogle Scholar
  2. 2.A.W. Appel. Compiling with continuations. Cambridge University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3.L. Augustsson. Implementing HaskeH overloading. To appear in Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, June 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4.L. Damas and R. Milner. Principal type schemes for functional programs. In 8th Annual A CM Symposium on Principles of Programming languages, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5.K. Hammond and S. Blott. Implementing Haskell type classes. Proceedings of the 1989 Glasgow Workshop on Functional Programming, Fraserburgh, Scotland. Workshops in computing series, Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6.P. Hudak, S.L. Peyton Jones and P. Wadler (eds.). Report on the programming language Haskell, version 1.2. A CM SIGPLAN notices, 27, 5, May 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7.M.P. Jones. Computing with lattices: An application of type classes. Journal of Functional Programming, Volume 2, Part 4, October 1992.Google ScholarGoogle ScholarCross RefCross Ref
  8. 8.M.P. Jones. Qualified types: Theory and Practice. D. Phil. Thesis. Programming Research Group, Oxford University Computing Laboratory. July 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9.S.L. Peyton Jones and D. Lester. A modular fully-lazy lambda lifter in HaskeU. Software - Practice and Experience, 21(5), May 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10.S.L. Peyton Jones and P. Wadler. A static semantics for Haskell (draft). Manuscript, Department of Computing Science, University of Glasgow, February 1992.Google ScholarGoogle Scholar
  11. 11.P. WacUer and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In A CM Principles of Programming Languages, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Implementing type classes

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          PLDI '93: Proceedings of the ACM SIGPLAN 1993 conference on Programming language design and implementation
          August 1993
          313 pages
          ISBN:0897915984
          DOI:10.1145/155090

          Copyright © 1993 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 June 1993

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          Overall Acceptance Rate406of2,067submissions,20%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader