parallelizing ghc

Evan Laforge qdunkan at
Tue Jan 24 19:04:28 CET 2012

> One immediate problem I see with this is linking - 'ghc --make
> Main.hs' is able to figure out what packages a program depends on,
> while 'ghc Main.o ... -o Main' requires the user to specify them
> manually with -package. So you'll either need to pass this information
> back to the parent process, or use 'ghc --make' for linking (which
> adds more overhead).

Well, figuring out dependencies is the job of the build system.  I'd
be perfectly happy to just invoke ghc with a hardcoded package list as
I do currently, or as you said, invoke --make just to figure out the
package list for me.  The time is going to be dominated by linking,
which is single threaded anyway, so either way works.

It would be a neat feature to be able to ask ghc to figure out the
packages needed for a particular file and emit them for the build
system (or is there already a way to do that currently?), but it's
orthogonal I think.  Probably not hard though, just stick a knob on
--make that prints the link line instead of running it.

> There is in fact an '--interactive' flag already, 'ghc --interactive'
> is a synonym for 'ghci'.

Oh right, well some other name then :)

> I'm also interested in a "build server" mode for ghc. I have written a
> parallel wrapper for 'ghc --make' [1], but the speed gains are not as
> impressive [2] as I hoped because of the duplicated work.

Was the duplicated work rereading .hi files, or was there something else?

More information about the Glasgow-haskell-users mailing list