seeking ideas for short lecture on type classes
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'm especially in need of a guide to the literature, as the `Haskell bookshelf' at haskell.org is silent on the topic of type classes. Please send me your recommendations. Norman Ramsey
--- 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'm especially in need of a guide to the literature, as the `Haskell bookshelf' at haskell.org is silent on the topic of type classes.
http://www.research.avayalabs.com/user/wadler/topics/type-classes.html http://www.dcs.qmul.ac.uk/SEL-HPC/Articles/GeneratedHtml/functional.imptype.... http://haskell.readscheme.org/lang_sem.html ===== Christopher Milton cmiltonperl@yahoo.com __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
G'day all. On Fri, Jan 24, 2003 at 06:13:29PM -0500, Norman Ramsey 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. Cheers, Andrew Bromage
On Saturday, January 25, 2003, at 04:14 AM, Andrew J Bromage wrote:
G'day all.
On Fri, Jan 24, 2003 at 06:13:29PM -0500, Norman Ramsey 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.
While Java and C++ don't support it other object oriented languages do. Extending and amending the capabilities of existing classes is important in Objective-C (through categories and posing) and TOM. Smalltalk also supports it. Regards, John Hornkvist
On 26-Jan-2003, John H?rnkvist <john@toastedmarshmallow.com> wrote:
On Saturday, January 25, 2003, at 04:14 AM, Andrew J Bromage wrote:
G'day all.
On Fri, Jan 24, 2003 at 06:13:29PM -0500, Norman Ramsey 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.
While Java and C++ don't support it other object oriented languages do.
Some others do, some others don't. And in fact it seems that most mainstream OOP languages don't. For example C#, Eiffel and Ada-95 don't, if I recall correctly. Sather does support it, but Sather is hardly mainstream (the language is just about dead these days). GNU C++ used to support it, with the "signature" extension, but doesn't anymore (support for that extension was dropped). Of the vaguely mainstream OOP languages, I think only the dynamically-typed ones support it. -- 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.
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.
participants (5)
-
Andrew J Bromage -
Christopher Milton -
Fergus Henderson -
John Hörnkvist -
nr@eecs.harvard.edu