Haskell run-time tutorial

Matt Hellige matt@immute.net
Sat, 14 Dec 2002 11:02:29 -0600


[Jonathan Holt <jony42us@yahoo.com>]
> 
> I've tried reading some of the articles related to the
> design of GHC's run-time. But they don't seem to be
> much help. They either assume that the reader has
> prior knowledge of functional-programming run-time
> environments, or get into very low-level details. And
> at the end of the day, this is very confusing, and I
> find terms like thunks, entries,
> partial-function-applications, etc. floating in my
> head hoplessly seeking anchor.
> 
> So, where can one find a good introductory book /
> article on the subject?
> 

I found the book:

Simon Peyton-Jones and David Lester
"Implementing Functional Languages: A Tutorial"
Prentice Hall, 1992

very helpful. The actual techniques discussed differ from the
technique used by most Haskell compilers, but the book provided the
background I needed to follow Simon's newer papers on the subject,
particularly:
"Implementing lazy functional languages on stock hardware: the Spineless
Tagless G-machine"
"The Glasgow Haskell compiler: a technical overview"
"Compiling Haskell by program transformation: a report from the trenches"

The book I mentioned is, I believe, out of print, although I found my
copy new just a couple of years ago. The complete text is available
on-line at: 
http://research.microsoft.com/~simonpj/Papers/pj-lester-book/
This book should not be confused with the similarly named:

Simon Peyton-Jones
"Implementation of Functional Programming Languages"
Prentice Hall

which is also out of print. I've never
seen the latter book, but someone's currently selling it used on
Amazon for $300, if you're so inclined... ;)

All the papers I mentioned (and plenty more, all worth a look) are at:
http://research.microsoft.com/~simonpj/Papers/papers.html#compiler

If you still find this stuff going over your head, perhaps you should
check out the following, both of which I've found useful in their own
ways:

Chris Reade
"Elements of Functional Programming"
Addison-Wesley, 1989

  An interesting mix of practical programming instruction and more
  theoretical stuff, using SML. Introduces lambda calculus and normal
  forms, lazy and eager evaluation, denotational semantics, basic type
  checking and inference Hindley-Milner style, and several
  implementation techniques. Dated in many ways, but good.

Dick Grune, Henri E. Bal, Ceriel J.H. Jacobs and Koen G. Langendoen
"Modern Compiler Deign"
J. Wiley, 2000

  Chapter 7 is devoted to compiling functional languages, and uses
  Haskell as its example. 

I realize that there's really a lot of material there, but it's very
much worth understanding! It definitely makes one realize how much one
takes for granted a relatively complete understanding of the
implementation of one's usual languages. I suppose we've just slowly
absorbed so much of that info wrt procedural and OO languages that we
don't tend to realize just how much we actually learned.

In any case, enjoy learning all this stuff. I know I have!

Matt

-- 
Matt Hellige                  matt@immute.net
http://matt.immute.net