Type Classes as Objects and Implicits

Type classes were originally developed in Haskell as a disciplined alternative to ad-hoc polymorphism. Type classes have been shown to provide a type-safe solution to important challenges in software engineering and programming languages such as, for example, retroactive extension of programs. They are also recognized as a good mechanism for concept-based generic programming and, more recently, have evolved into a mechanism for type-level computation. This paper presents a lightweight approach to type classes in object-oriented (OO) languages with generics using the Concept pattern and implicits (a type-directed implicit parameter passing mechanism). This paper also shows how Scala’s type system conspires with implicits to enable, and even surpass, many common extensions of the Haskell type class system, making Scala ideally suited for generic programming in the large.

Published in:
Proceedings of the ACM international conference on Object oriented programming systems languages and applications, 341-360
Presented at:
OOPSLA/SPLASH’10, Reno/Tahoe, Nevada, USA, October 17-21, 2010

 Record created 2010-08-05, last modified 2018-01-28

External link:
Download fulltext
Rate this document:

Rate this document:
(Not yet reviewed)