skip to main content
research-article

A simple semantics for Haskell overloading

Published:03 September 2014Publication History
Skip Abstract Section

Abstract

As originally proposed, type classes provide overloading and ad-hoc definition, but can still be understood (and implemented) in terms of strictly parametric calculi. This is not true of subsequent extensions of type classes. Functional dependencies and equality constraints allow the satisfiability of predicates to refine typing; this means that the interpretations of equivalent qualified types may not be interconvertible. Overlapping instances and instance chains allow predicates to be satisfied without determining the implementations of their associated class methods, introducing truly non-parametric behavior. We propose a new approach to the semantics of type classes, interpreting polymorphic expressions by the behavior of each of their ground instances, but without requiring that those behaviors be parametrically determined. We argue that this approach both matches the intuitive meanings of qualified types and accurately models the behavior of programs.

References

  1. W. Harrison. A simple semantics for polymorphic recursion. In Proceedings of the 3rd Asian Symposium on Programming Languages and Systems, APLAS '05, pages 37--51, Tsukuba, Japan, 2005. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. P. Jones. A theory of qualified types. In B. K. Bruckner, editor, Proceedings of the 4th European symposium on programming, volume 582 of ESOP'92. Springer-Verlag, Rennes, France, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. P. Jones. Coherence for qualified types. Technical Report YALEU/DCS/RR-989, Yale University, 1993.Google ScholarGoogle Scholar
  4. M. P. Jones. Simplifying and improving qualified types. In Proceedings of the seventh international conference on Functional programming languages and computer architecture, FPCA '95, pages 160--169, La Jolla, California, USA, 1995. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. P. Jones. Type classes with functional dependencies. In Proceedings of the 9th European Symposium on Programming Languages and Systems, ESOP '00, pages 230--244, Berlin, Germany, 2000. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. P. Jones and I. S. Diatchki. Language and program design for functional dependencies. In Proceedings of the first ACM SIGPLAN symposium on Haskell, Haskell '08, pages 87--98, Victoria, BC, Canada, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, (17): 348--375, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  8. J. C. Mitchell. Polymorphic type inference and containment. Inf. Comput., 76 (2--3): 211--249, Feb. 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J. C. Mitchell and R. Harper. The essence of ML. In Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '88, pages 28--46, San Diego, California, USA, 1988. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. G. Morris and M. P. Jones. Instance chains: Type-class programming without overlapping instances. In Proceedings of the 15th ACM SIGPLAN international conference on Functional programming, ICFP '10, Baltimore, MD, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. Odersky, P. Wadler, and M. Wehr. A second look at overloading. In Proceedings of the seventh international conference on Functional programming languages and computer architecture, FPCA '95, pages 135--146, La Jolla, California, USA, 1995. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. A. Ohori. A simple semantics for ML polymorphism. In Proceedings of the fourth international conference on Functional programming languages and computer architecture, FPCA '89, pages 281--292, London, UK, 1989. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Peyton Jones, M. P. Jones, and E. Meijer. Type classes: an exploration of the design space. In Proceedings of the 1997 workshop on Haskell, Haskell '97, Amsterdam, The Netherlands, 1997.Google ScholarGoogle Scholar
  14. M. Sulzmann, M. M. T. Chakravarty, S. P. Jones, and K. Donnelly. System f with type equality coercions. In Proceedings of the 2007 ACM SIGPLAN international workshop on Types in language design and implementation, TLDI '07, pages 53--66, Nice, France, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Sulzmann, G. J. Duck, S. Peyton Jones, and P. J. Stuckey. Understanding functional dependencies via constraint handling rules. JFP, 17 (1): 83--129, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '89, pages 60--76, Austin, Texas, USA, 1989. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A simple semantics for Haskell overloading

      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

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 49, Issue 12
        Haskell '14
        December 2014
        141 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2775050
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          Haskell '14: Proceedings of the 2014 ACM SIGPLAN symposium on Haskell
          September 2014
          154 pages
          ISBN:9781450330411
          DOI:10.1145/2633357

        Copyright © 2014 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 3 September 2014

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!