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:
“... 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 (18711922)
“My plan of instruction is extremely simple and limited. They learn, on week-days, such coarse works as may fit them for servants. I allow of no writing for the poor. My object is not to make fanatics, but to train up the lower classes in habits of industry and piety.”
—Hannah More (17451833)