- Type class
In
computer science , a type class is atype system construct that supports ad-hoc polymorphism. This is achieved by adding constraints to type variables in parametrically polymorphic types. Such a constraint typically involves a type classT
and a type variablea
, and means thata
can only be instantiated to a type whose members support the overloaded operations associated withT
.Type classes first appeared in the Haskell programming language, and were originally conceived as a way of implementing overloaded arithmetic and equality operators in a principled fashion.]
See also
*
Polymorphism (computer science) (other kinds of polymorphism)
* Haskell programming language (the language in which type classes were designed)
*Operator overloading (one application of type classes)
*Monads in functional programming (Monad
is an example of a type class)References
* Simon Peyton Jones, Mark Jones, Erik Meijer. " [http://research.microsoft.com/~simonpj/Papers/type-class-design-space Type classes: an exploration of the design space] ". From Proc. ACM SIGPLAN Haskell Workshop. May, 1997.
* Mark Jones. " [http://web.cecs.pdx.edu/~mpj/pubs/fundeps.html Type Classes with Functional Dependencies] ". From Proc. 9th European Symposium on Programming. March, 2000.External links
* A Gentle Introduction to Haskell, Version 98, chapter [http://www.haskell.org/tutorial/classes.html 5. Type Classes and Overloading] . June 2000.
* Advanced Functional Programming course at Utrecht University, 74 lecture slides on [http://www.cs.uu.nl/wiki/pub/Afp/CourseSchedule/AFP-classes.pdf Advanced Type Classes] . 2005-06-07.
Wikimedia Foundation. 2010.