A system of constructor classes: overloading and implicit higher-order polymorphism
Author:
Open Access
- 7 November 2008
- journal article
- research article
- Published by Cambridge University Press (CUP) in Journal of Functional Programming
- Vol. 5 (1) , 1-35
Abstract
This paper describes a flexible type system that combines overloading and higher-order polymorphism in an implicitly typed language using a system of constructor classes —a natural generalization of type classes in Haskell. We present a range of examples to demonstrate the usefulness of such a system. In particular, we show how constructor classes can be used to support the use of monads in a functional language. The underlying type system permits higher-order polymorphism but retains many of the attractive features that have made Hindley/Milner type systems so popular. In particular, there is an effective algorithm that can be used to calculate principal types without the need for explicit type or kind annotations. A prototype implementation has been developed providing, amongst other things, the first concrete implementation of monad comprehensions known to us at the time of writing.Keywords
This publication has 12 references indexed in Scilit:
- Building interpreters by composing monads1994
- A gentle introduction to HaskellACM SIGPLAN Notices, 1992
- Report on the programming language HaskellACM SIGPLAN Notices, 1992
- The essence of functional programming1992
- Parametric type classes1992
- A functional theory of exceptionsScience of Computer Programming, 1990
- How to make ad-hoc polymorphism less ad hoc1989
- Modules for standard ML1984
- A theory of type polymorphism in programmingJournal of Computer and System Sciences, 1978
- A Machine-Oriented Logic Based on the Resolution PrincipleJournal of the ACM, 1965