Typing Haskell in Haskell

NOTICE: As of November 1, 2000, a more recent version of the materials here is available from http://www.cse.ogi.edu/~mpj/thih.

Last updated:September 27, 2000


Haskell benefits from a sophisticated type system, but implementors, programmers, and researchers suffer because it has no formal description. To remedy this shortcoming, we present a Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a notation that is familiar to Haskell users. We expect this program to fill a serious gap in current descriptions of Haskell, both as a starting point for discussions about existing features of the type system, and as a platform from which to explore new proposals.


The current version of the paper is available here in gzipped Postscript (US letter size), gzipped Postscript (A4 size), PDF (portable document format), and HTML formats.

The source code for the type checker is derived from exactly the same source as the code shown in the paper, but it also contains quite a lot of extra code for testing and printing. So, as long as I do my job properly, you can be sure that (a) what you see in the paper actually works, and that (b) the code and the paper are consistent with each other! The source code is available in two different formats:

Several people have asked me if I have a version of Typing Haskell in Haskell that works with multiple parameter classes. In fact, I have a couple. Here's the one that is closest to the September 1, 1999 release as a gzipped tar file: thih-multiparam.tar.gz.

Please note that further revisions to this paper and software are already planned or in progress.

Revision History

September 27, 2000:
Added an HTML version of the September 1, 1999 paper.
March 1, 2000:
Tom Pledger has contributed an implementation of SourceMonad.hs. Thanks Tom! I am still working on a revised version of the system; watch for more news later!
October 5, 1999:
Finally, the source code has been added to the web page,
September 1, 1999:
Minor tweaks to the presentation. Unless somebody finds a major flaw in the next couple of days, this is the version that will be presented at the Haskell workshop!
August 18, 1999:
Further tweaks to the presentation, removing inst from the Types class, adding comments about testing.
August 10, 1999:
Improved the presentation of defaulting, context reduction, and patterns, and fixed some typos in the paper. The paper has been accepted for presentation at the Third Haskell Workshop, which will take place in Paris on October 1.
July 31, 1999:
New version of the paper, including a couple of bug fixes!
June 30, 1999:
First public draft of paper.


Comments, suggestions, and bug reports are all welcome; please contact me at mpj@cse.ogi.edu.