Re: Types Query: type classes and SML modules?
To: Tom Murphy <firstname.lastname@example.org>
Subject: Re: Types Query: type classes and SML modules?
From: Fergus Henderson <email@example.com>
Date: Mon, 10 Dec 2001 12:45:11 +1100
On 07-Dec-2001, Tom Murphy <firstname.lastname@example.org> wrote:
> We are looking for papers about integrating type classes into an SML-style
> module system. Does anyone have any papers or pointers?
I'm not sure if this will be helpful, but if you're looking at how type
classes interact with module systems in general, then you might want to
look at what we've done with type classes in Mercury. Mercury's module
system is not an SML-style module system, however.
Mercury's type class system is quite similar to Haskell's, but there
are some differences, including some related to the module system.
In particular, Mercury allows abstract type class declarations and
abstract instance declarations. Abstract type class declarations mean
that a library module can, if the programmer so desires, export a type
class in such a way that client modules that import the library module
can use the type class in type class constraints, but may not create
new instances of the type class. Abstract instance declarations are
part of the means by which Mercury gives the programmer explicit control
over which instance declarations are exported to client modules (unlike
Haskell, where all instance declarations are always exported).
Mercury's type class system is described in the Mercury language
reference manual, which is available from the Documentation section
of the Mercury web site <http://www.cs.mu.oz.au/mercury/>;
in the paper "Type classes in Mercury", which is available from
the Papers subsection of the Information section of the same web site;
and in David Jeffery's recently-submitted PhD thesis, which you can
probably obtain from the author <email@example.com>.
Fergus Henderson <firstname.lastname@example.org> | "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.