Type classes and code generation

Keith Wansbrough Keith.Wansbrough@cl.cam.ac.uk
Tue, 17 Jun 2003 15:42:24 +0100


> Does this also mean that a dictionary class is created for every class, and
> a dictionary created for every instance?

Yes, exactly.  Every class is translated to a data type declaration, 
and every instance is translated to an element of that data type - a 
dictionary.  (Note that you can't actually write those declarations in 
Haskell 98 in general, because they can have polymorphic fields; but 
this is a simple extension to the language).

Take a look at one of the references Bernard put on the bottom of the
Wiki page I just created for further information.

http://www.haskell.org/hawiki/TypeClass

--KW 8-)