|
ABSTRACT
We present a new approach to the semantics of languages with ML-like polymorphic types and type classes. The goals of the new approach are simplicity and generality. Our typing rules are a relatively straightforward extension of the rules for translating core-ML to core-XML. The new features are an encoding of classes as recursive sets of types, and class-membership constraints on types. We show that the soundness of this type of system is independent of the fixedpoint operator used to interpret (recursive) classes, and thus there is no room to engineer a sound notion of well-typing based on other considerations such as decidability. These ideas are applied to investigate the appropriateness of Haskell-style type inference which uses backward chaining for inference of instance relationships. Haskell's algorithm turns out to imply a least fixed point semantics for classes. We show that the Haskell approach is correct and complete for the special case of convergent classes. Although this includes all classes definable in Haskell, most proper extensions of Haskell allow classes that are not convergent, which helps explain the negative results for decidability of type inference for many extensions.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Alexander Aiken and Edward L. Wimmers. Solving systems of set constraints. In Proceedings of Seventh LICS Symposium. IEEE Computer Society Press, 1992.
|
| |
2
|
Stephen Blott. Type Classes. PhD thesis, University of Glasgow, 1991.
|
 |
3
|
Kung Chen , Paul Hudak , Martin Odersky, Parametric type classes, Proceedings of the 1992 ACM conference on LISP and functional programming, p.170-181, June 22-24, 1992, San Francisco, California, United States
|
| |
4
|
P. Hudak, S. Peyton Jones, and P. Wadler (editors). Report on the Programming Language Haskell, A Non-strict Purely Functional Language (Version 1.1). Technical Report YALEU/DCS/RR777, Yale University, Department of Computer Science, August 1991.
|
| |
5
|
Mark Jones. Efficient implementation of type class overloading. Manuscript, March 1992.
|
| |
6
|
|
| |
7
|
|
| |
8
|
|
| |
9
|
|
| |
10
|
|
 |
11
|
|
 |
12
|
|
| |
13
|
|
| |
14
|
W.A. Sutherland. Introduction to Metric and Topological Spaces. Oxford University Press, 1975.
|
| |
15
|
Alfred Tarski. A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics, 5:285-309, 1955.
|
| |
16
|
Satish R. Thattd. A simple notion of multiparameter classes with an undecidable type reconstruction problem. Unpublished note (available upon request), 1993.
|
| |
17
|
|
 |
18
|
|
CITED BY 8
|
Catherine Dubois , François Rouaix , Pierre Weis, Extensional polymorphism, Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.118-129, January 23-25, 1995, San Francisco, California, United States
|
|
|
|
|
|
Martin Odersky , Philip Wadler , Martin Wehr, A second look at overloading, Proceedings of the seventh international conference on Functional programming languages and computer architecture, p.135-146, June 26-28, 1995, La Jolla, California, United States
|
|
|
|
|
|
|
|
|
|
|