How to make ad-hoc polymorphism less ad hoc
October 1988How to make ad-hoc polymorphism less ad hocHow to make ad-hoc polymorphism less ad hoc
The Haskell committee, unsatisfied with polymorphism in existing functional languages, sought a new approach for their new language. The answer, as it appears in Haskell 1.0, was put forth in this paper: type classes.
This research was specifically motivated by two examples: arithmetic operations and equality testing, corresponding to the
Eq classes respectively. Both of these classes were incorporated into Haskell and are still in use (with some additions) today.
The paper contrasts the proposed feature against two languages that existed at the time — Standard ML and Miranda — both of which have a similar syntax to Haskell and use the same Hindley/Milner type system.
To a modern Haskell user, the biggest deficiency of this initial incarnation of type classes is that it only permitted polymorphism over concrete types, not over type constructors. Once constructor classes appear eight years later in Haskell 1.3, the power of type classes will expand greatly.
Authors: Philip Wadler and Stephen Blott