recompilation on --main-is

Conrad Parker conrad at
Thu Feb 16 05:37:56 CET 2012


We have a project with around 200 Haskell source files, and around 20
executables which import these (as well as importing third-party
libraries). We first build all the non-main files using a makefile
generated with ghc -M. We then build the executables using a separate
invocation of "ghc --make --main-is foo.hs", for each foo.hs. This
worked fine with ghc-7.2.1; each final "ghc --make" would simply link
the pre-built object files -- but with ghc-7.4.1 all these files are
recompiled for each target executable. As a result our full build
takes around 10-20x longer with ghc-7.4.1 than ghc-7.2.1.

Looking at compiler/iface/FlagChecker.hs, it seems that the --main-is
flag is used as an input to the recompilation checker. It would make
sense that --main-is should force recompilation of the particular file
that exports 'main', but it also forces recompilation of its
dependencies. Is this a bug or is there a good reason to recompile


More information about the Glasgow-haskell-users mailing list