seeking ideas for short lecture on type classes
Fergus Henderson
fjh@cs.mu.OZ.AU
Mon, 27 Jan 2003 20:48:50 +1100
On 26-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.
> >
> > Will they have had exposure to more "traditional" OO programming? If
> > so, it might be useful to note the difference between Haskell type
> > classes and C++/Java/whatever classes, namely that Haskell decouples
> > types and the interfaces that they support. The advantage is that you
> > can extend a type with a new interface at any point, not just when you
> > define the type.
>
> Hmm --- you are talking about the `instance' declarations, right?
Yes -- the fact that Haskell has separate instance declarations,
as opposed to making this information part of the `data' declaration.
In most OO languages inheritence relations need to be specified in the
type definition.
--
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.