[Haskell-cafe] Code generation and optimisation for compiling Haskell

Steve Horne sh006d3592 at blueyonder.co.uk
Tue Jan 10 18:25:15 CET 2012

Although I'm far from being an expert Haskell programmer, I think I'm 
ready to look into some of the details of how it's compiled. I've a copy 
of Modern Compiler Design (Grune, Bal, Jacobs and Langendoen) - I first 
learned a lot of lexical and parsing stuff from it quite a few years 
ago. Today, I started looking through the functional languages section - 
I've read it before, but never absorbed much of it.

Graph reduction, lambda lifing, etc - it seems pretty simple. Far too 
simple. It's hard to believe that decent performance is possible if all 
the work is done by a run-time graph reduction engine.

Simon Peyton Jones has written a couple of books on implementing 
functional languages which are available for free download. At a glance, 
they seem to covers similar topics in much more detail. However, they're 
from 1987 and 1992. Considering SPJs period "of despair" when he 
couldn't get practical performance for monadic I/O, these seem very dated.

Some time ago, I made a note to look up the book "Functional Programming 
and Parallel Graph Rewriting" (I forget why) but again that's from the 
early 90's. I've also got a note to look up Urban Boquists thesis.

SPJ also has some papers on compilation - 
- and the papers on optimisation by program transformation have caught 
my eye.

Are there any current text-books that describe the techniques used by 
compilers like GHC to generate efficient code from functional languages? 
It's OK to assume some knowledge of basic compiler theory - the 
important stuff is code generation and optimisation techniques for lazy 
functional languages in particular.

Also, what papers should I read? Am I on the right lines with the ones 
I've mentioned above?

More information about the Haskell-Cafe mailing list