Hostname: page-component-8448b6f56d-c47g7 Total loading time: 0 Render date: 2024-04-20T15:11:41.742Z Has data issue: false hasContentIssue false

Type Reconstruction for Type Classes1

Published online by Cambridge University Press:  07 November 2008

Tobias Nipkow
Affiliation:
Institut für Informatik, Technische Universität München, 80290 München, Germany. email: {nipkow, prehofer}@informatik.tu-muenchen.de
Christian Prehofer
Affiliation:
Institut für Informatik, Technische Universität München, 80290 München, Germany. email: {nipkow, prehofer}@informatik.tu-muenchen.de
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We study the type inference problem for a system with type classes as in the functional programming language Haskell. Type classes are an extension of ML-style polymorphism with overloading. We generalize Milner's work on polymorphism by introducing a separate context constraining the type variables in a typing judgement. This leads to simple type inference systems and algorithms which closely resemble those for ML. In particular, we present a new unification algorithm which is an extension of syntactic unification with constraint solving. The existence of principal types follows from an analysis of this unification algorithm.

Type
Articles
Copyright
Copyright © Cambridge University Press 1995

References

Blott, S. 1992. An approach to overloading with polymorphism. PhD thesis, Dept. of Computing Science, University of Glasgow.Google Scholar
Burstall, R., MacQueen, D. and Sannella, D. 1980. Hope: an experimental applicative language. In Proc. 1980 LISP Conference, pages 136143.Google Scholar
Clément, D., Despeyroux, J., Despeyroux, T. and Kahn, G. 1986. A simple applicative language: Mini-ML. In Proc. ACM Conf. Lisp and Functional Programming, pages 1327.Google Scholar
Chen, K., Hudak, P. and Odersky, M.06 1992. Parametric type classes. In Proc. ACM Conf. on LISP and Functional Programming, pages 170181. ACM Press.Google Scholar
Damas, L. and Milner, R. 1982. Principal type schemes for functional programs. In Proc. 9th ACM Symp. Principles of Programming Languages, pages 207212.Google Scholar
Hudak, P., Jones, S. P. and Wadler, P.05 1992. Report on the programming language Haskell: A non-strict, purely functional language. ACM SIGPLAN Notices, 27(5), Version 1.2.CrossRefGoogle Scholar
Jones, M. P.07 1992. Qualified types: Theory and practice. D.Phil. Thesis, Programming Research Group, Oxford University Computing Laboratory.Google Scholar
Jones, M. P. 1992. A theory of qualified types. In Bernd Krieg-Brückner, , editor, Proc. European Symposium on Programming, pages 287306. LNCS 582.Google Scholar
Kaes, S. 1988. Parametric overloading in polymorphic programming languages. In Proc. 2nd European Symposium on Programming, pages 131144. LNCS 300.Google Scholar
Kaes, S.06 1992. Type inference in the presence of overloading, subtyping and recursive types. In Proc. ACM Conf. LISP and Functional Programming, pages 193204. ACM Press.Google Scholar
Milner, R. 1978. A theory of type polymorphism in programming. J. Comp. Sys. Sci., 17:348375.CrossRefGoogle Scholar
Milner, R., Tofte, M. and Harper, R. 1990. The Definition of Standard ML. MIT Press.Google Scholar
Nipkow, T. and Prehofer, C. 1993. Type checking type classes. In Proc. 20th ACM Symp. Principles of Programming Languages, pages 409418. ACM Press.Google Scholar
Nipkow, T. and Snelting, G. 1991. Type classes and overloading resolution via order-sorted unification. In Proc. 5th ACM Conf. Functional Programming Languages and Computer Architecture, pages 114. LNCS 523.Google Scholar
Peterson, J. and Jones, M. 1983. Implementing type classes. In Proc. SIGPLAN '93 Symp. Programming Language Design and Implementation, pages 227236. ACM Press.Google Scholar
Volpano, D. M. and Smith, G. S. 1991. On the complexity of ML typability with overloading. In Proc. 5th ACM Conf. Functional Programming Languages and Computer Architecture, pages 1528. LNCS 523.CrossRefGoogle Scholar
Wadler, P. and Blott, S. 1989. How to make ad-hoc polymorphism less ad hoc. In Proc. 16th ACM Symp. Principles of Programming Languages, pages 6076.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.