[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Type classes (Nipkow)

Tobias Nipkow asked me to forward the following.
(Hi Tobias!  By the way, I think your paper is Good Stuff.)  -- P


Newsgroups: mail.haskell
Path: cam-cl!news
From: tnn@ely.cl.cam.ac.uk (Tobias Nipkow)
Subject: Re: The scope of type variables
Message-ID: <1991Mar31.101756.11204@cl.cam.ac.uk>
Sender: news@cl.cam.ac.uk (The news facility)
Reply-To: tnn@ely.cl.cam.ac.uk (Tobias Nipkow)
References:  <9103301457.AA10553@sun.mcs.clarkson.edu>
Date: Sun, 31 Mar 91 10:17:56 GMT

Just for the record: The syntax for class and instance declarations that
Satish Thatte is proposing is pretty much the one that Gregor Snelting and
myself used in a report about type classes written last August [1]. Class and
instance declarations in Mini-Haskell (a tiny sublanguage of Haskell defined
in that report) have roughly the following syntax:

	class C <= C1,...,Ck where ...

	instance T: (C1,...,Cn) C where ...

where T is the name of a type constructor, and the Ci and C are class names.
This notation emphasizes the main point of that paper, namely that type
constructors are functions on an order-sorted universe of types, and that
instance declarations declare arities of type constructors. In Satish's
variant you would write

	class C <= C1*...*Ck where ...

	instance C (T C1 ... Cn) where ...

Later on in the report the idea of "conjunctive sorts" is introduced,
corresponding to Satish's "class intersection". Instead of "C1*C2" we write
"C1 /\ C2".

A revised version of [1] is available from me upon request. I have included
the abstract below.


[1] T. Nipkow and G. Snelting. Type Classes and Overloading Resolution via
Call set up problem - Campus Nmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm                                     eeeeeeeeeeeeeeeeeeevvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrlookup failure - Name probably deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee                                                   oooooooooooooooooooooooooooooooooooooooooooooo                                                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsssssssssssssssssssssssssssssssssssssssss