[Haskell-cafe] Why isn't "Program Derivation" a first class citizen?

Jan Stolarek jan.stolarek at p.lodz.pl
Wed Feb 13 08:37:37 CET 2013


> To me, it seems that something like this should be possible -- am i being
> naive? does it already exist?  
During the compilation process GHC optimizes the code by performing successive transformations of 
the program. These transformations are known to preserve meaning of the program - they are based 
on some already proved facts and properties. I've written a blog post recently on this:

http://lambda.jstolarek.com/2013/01/taking-magic-out-of-ghc-or-tracing-compilation-by-transformation/

Now, you might be asking why does GHC transform the Core representation of a program and not the 
original Haskell code itself? The answer is simplicity. Core is equivalent to Haskell, but it's 
much easier to work with since there are few language constructs and it's easier to design 
transformations and prove them correct.

I hope this at least partially answers your question. Whether there automated ways of transforming 
Haskell programs into more efficient Haskell programs I don't know.

Janek



More information about the Haskell-Cafe mailing list