Type Class

In computer science, a type class is a type 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 class T and a type variable a, and means that a can only be instantiated to a type whose members support the overloaded operations associated with T.

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. In contrast with the "eqtypes" of Standard ML, overloading the equality operator through the use of type classes in Haskell does not require extensive modification of the compiler frontend or the underlying type system.

Since their creation, many other applications of type classes have been discovered.

Read more about Type Class:  Overview, Higher-kinded Polymorphism, Multi-parameter Type Classes, Functional Dependencies, Other Approaches To Operator Overloading, Related Notions

Famous quotes containing the words type and/or class:

    “... In truth I find it ridiculous that a man of his intelligence suffer over this type of person, who is not even interesting, for she is said to be foolish”, she added with all the wisdom of people who are not in love, who find that a sensible man should only be unhappy over a person who is worthwhile; it is almost tantamount to being surprised that anyone deign having cholera for having been infected with a creature as small as the vibrio bacilla.
    Marcel Proust (1871–1922)

    The prostitute is the scapegoat for everyone’s sins, and few people care whether she is justly treated or not. Good people have spent thousands of pounds in efforts to reform her, poets have written about her, essayists and orators have made her the subject of some of their most striking rhetoric; perhaps no class of people has been so much abused, and alternatively sentimentalized over as prostitutes have been but one thing they have never yet had, and that is simple legal justice.
    —Alison Neilans. “Justice for the Prostitute—Lady Astor’s Bill,” Equal Rights (September 19, 1925)