Software And Tools

TS0506

EHC

See the EHC homepage.

Helium

Helium homepage: http://www.cs.uu.nl/helium/

How to build Helium

First of all, you need access to the CVS repository (http://cvs.cs.uu.nl/). Then, type in the following commands.

cvs checkout heliumNT
cvs checkout parsec
cvs checkout lvm
cvs checkout Top
cd lvm/src
./configure
cd ../../heliumNT/
./configure
cd src
make depend
make

Once you have built the compiler, you can test whether it works properly on your machine. To run a (large) number of test files, type:

cd ../test
./testAll

Invoking the Helium compiler

The Helium compiler can be used in two modes: with support for type classes, or without. To use the compiler with type classes, you have to provide the flag --overloading when invoking the compiler, and make sure that the overloaded Prelude (in the lib directory) is in the search path. A search path can be provided using the -P flag.

Helium's closed type classes

A full description of the differences between Helium and the Haskell 98 standard can be found in HeliumDiffHaskell98.html: this file is located in the heliumNT/docs directory.

Recently, the Helium compiler was extended to support closed world type classes. A number of predefined type classes are now available (such as Eq, Ord, Show) with a fixed number of instances (only basic types). In addition to these fixed instances, new instances can be derived automatically for the Eq and Show type classes only. This approach has two major disadvantages:

  • New type classes (or instances) cannot be defined.
  • The code corresponding to the build-in class definitions and instance definitions has been written in an untyped(!) core language, which is very error-prone. See PreludePrim.core in the lib directory.

Your task

Extend the compiler to support Haskell 98 type classes. You will have to deal with the following aspects:
  • What are the static checks prior to type inference (e.g., is the superclass hierarchy acyclic)
  • Type inference for the definitions in a class/instance declaration.
  • The interaction between type inference and code generation.
  • The interaction between type classes and Helium's (simplified) module system
  • Redesign the class declarations and instance declarations in the Prelude (currently hard-coded).

Keep in mind that a lot of the machinery for type classes is already present!

-- BastiaanHeeren - 07 Sep 2005