Re: Types Query: type classes and SML modules?

On 07-Dec-2001, Tom Murphy <tom7+@cs.cmu.edu> 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 <dgj@cs.mu.oz.au>.

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.