seeking ideas for short lecture on type classes

Fergus Henderson fjh@cs.mu.OZ.AU
Mon, 27 Jan 2003 20:45:31 +1100


On 24-Jan-2003, Norman Ramsey <nr@eecs.harvard.edu> wrote:
> In a fit of madness, I have agreed to deliver a 50-minute lecture
> on type classes to an audience of undergraduate students.  These
> students will have seen some simple typing rules for F2 and will
> have some exposure to Hindley-Milner type inference in the context
> of ML.  I am soliciting advice about
>   * Cool examples of type classes
>   * Papers I could read to explain how to implement type classes,
>     especially if I could show the `dictionary translation' which
>     is then followed by ordinary Hindley-Milner type inference
>   * Any other material on which I might base such a lecture

I quite like the idea of treating of type checking/inference as constraint
solving: ordinary Hindley-Milner style type inference involves
solving type unification constraints, and with type classes
you just generalize this to first-order predicate calculus
(type classes are predicates on types, and instance declarations
are clauses).

@InProceedings{demoen_et_al,
        author =       {B. Demoen and M. {Garc\'{\i}a de la Banda} and
                        P.J. Stuckey},
        title =        {Type Constraint Solving for
                        Parametric and Ad-Hoc Polymorphism},
        booktitle =    {Proceedings of the 22nd
                        Australian Computer Science Conference},
        pages =        {217--228},
        month =        jan,
        year =         {1999},
        location =     {Auckland},
        publisher =    {Springer-Verlag},
        isbn =         {981-4021-54-7},
        editor =       {J. Edwards},
}                                                                               

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.