Multi-parameter Type Classes
Type classes permit multiple type parameters, and so type classes can be seen as relations on types. For example, in the GHC standard library, the class IArray
expresses a general immutable array interface. In this class, the type class constraint IArray a e
means that a
is an array type that contains elements of type e
. (This restriction on polymorphism is used to implement unboxed array types, for example.)
Haskell code that uses multi-parameter type classes is not portable, as this feature is not part of the Haskell 98 standard. The popular Haskell implementations GHC and Hugs support multi-parameter type classes.
Read more about this topic: Type Class
Famous quotes containing the words type and/or classes:
“It took six weeks of debate in the Senate to get the Arms Embargo Law repealedand we face other delays during the present session because most of the Members of the Congress are thinking in terms of next Autumns election. However, that is one of the prices that we who live in democracies have to pay. It is, however, worth paying, if all of us can avoid the type of government under which the unfortunate population of Germany and Russia must exist.”
—Franklin D. Roosevelt (18821945)
“Genocide begins, however improbably, in the conviction that classes of biological distinction indisputably sanction social and political discrimination.”
—Andrea Dworkin (b. 1946)