GHC core plugins

Simon Marlow marlowsd at
Fri Jan 29 04:52:03 EST 2010

On 29/01/10 09:32, José Pedro Magalhães wrote:
> Hi,
> 2010/1/28 Max Bolingbroke <batterseapower at
> <mailto:batterseapower at>>
>     2010/1/28 José Pedro Magalhães <jpm at <mailto:jpm at>>:
>      > Yes, that helped quite a lot. One last thing: currently it takes
>     me about 6
>      > minutes to rebuild the compiler after I change the core pass. Are
>     there any
>      > tricks of the build system I can use to speed this up? I'm
>     already using a
>      > fast build without optimizations and docs...
>     Hmm. Some things that help with this for me are to:
>     1) Compile with -j12 (or lower, depending on your hardware spec)
>     2) Compile with "cd compiler && make stage=2" to only build the stage
>     2 compiler (if this isn't already happening). Make sure the stage 1
>     compiler is built with optimisations! (I use the stage2devel
>     configuration, which already does this)
>     This reduces compile times to a few minutes for me. Still tedious, but
>     not too bad.
> Thanks. Doing this reduces compilation time to about 30s, but
> unfortunately my pass is not updated (even though it is compiled). I
> have to do 'make stage=2' at the root directory, not inside compiler.
> This brings compilation time to 1m10s (which is still better than what I
> was doing), but I really don't know what would need building outside the
> compiler directory...

The correct way to update your stage 2 compiler without rebuilding 
extraneous dependencies is:

   $ cd ghc
   $ make 2

for more info, see

> As an aside, is there any hope of using SYB in the core pass? As a
> generic programmer I quickly get tired of traversing the entire AST when
> I want just a few changes in specific places...

That's a discussion we ought to have at some point.  Note however that 
Core is actually a very deep data type (Ids contain unfoldings, which 
contain more expressions, which contain Ids, which contain types, and so 
on), and is also cyclic.  Simply traversing the whole thing would be a 
very bad idea.

There is a ghc-syb package which has SYB instances for HsSyn I think. 
HsSyn is not as deep or cyclic as Core.


More information about the Glasgow-haskell-users mailing list