Type extensions
Wolfgang Jeltsch
wolfgang@jeltsch.net
Fri, 29 Mar 2002 17:25:13 +0100
On Friday, March 29, 2002, 14:43 CET Ronald Legere wrote:
> [...]
> As far as I can tell, the following set of extensions has been included,
> for example in ghc:
> multiparameter type classes
> constructor classes
Type classes can be seen as a specific kind of constructor classes because a
type can be seen as a type constructor with zero arguments. So the
constructor class concept is more general than the type class concept.
Constructor classes aren't an extension but belong to the Haskell 98
standard. They didn't belong to some older versions of the standard, however.
Normally, a type or constructor class has one parameter --- a type or a type
constructor respectively. The multi-parameter type class concept extends the
ordinary *type* class concept such that classes can have multiple parameters
but these arguments have to be types. The multi-parameter constructor class
concept allows mulitple class parameters which may be arbitrary type
constructors.
I think GHC used to implement only multi-parameter type classes while Hugs
implemented multi-parameter constructor classes. The newer GHC versions
implement multi-parameter constructor classes as well.
> [...]
> Is there a paper out there that explains most or all of these extensions
> and why you would want them and HOW the heck they work together?
I don't know of such a paper. There is several information distributed over
several documents. Concerning (single-parameter) constructor classes, you may
consult some Haskell 98 document, for instance the Gentle introduction to
Haskell or the Haskell report. Concerning the other things, you may, for
example, have a look at Simon Peyton Jones' Haskell stuff, referenced on
http://research.microsoft.com/users/simonpj/.
> [...]
Wolfgang