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.
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- M. P. Jones. Coherence for qualified types. Technical Report YALEU/DCS/RR-989, Yale University, 1993.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, (17): 348--375, 1978.Google Scholar
Cross Ref
- J. C. Mitchell. Polymorphic type inference and containment. Inf. Comput., 76 (2--3): 211--249, Feb. 1988. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
A simple semantics for Haskell overloading
Recommendations
Type classes in Haskell
This article defines a set of type inference rules for resolving overloading introduced by type classes, as used in the functional programming language Haskell. Programs including type classes are transformed into ones which may be typed by standard ...
A simple semantics for Haskell overloading
Haskell '14: Proceedings of the 2014 ACM SIGPLAN symposium on HaskellAs 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 ...
Interactive type debugging in Haskell
Haskell '03: Proceedings of the 2003 ACM SIGPLAN workshop on HaskellIn this paper we illustrate the facilities for type debugging of Haskell programs in the Chameleon programming environment. Chameleon provides an extension to Haskell supporting advanced and programmable type extensions. Chameleon maps the typing ...







Comments