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:
“The Republican form of government is the highest form of government; but because of this it requires the highest type of human naturea type nowhere at present existing.”
—Herbert Spencer (18201903)
“There are two classes of men called poets. The one cultivates life, the other art,... one satisfies hunger, the other gratifies the palate.”
—Henry David Thoreau (18171862)