Package dependences for building versus linking

Duncan Coutts duncan.coutts at
Fri Oct 2 17:20:52 EDT 2009

On Fri, 2009-10-02 at 19:14 +0000, C Rodrigues wrote:
> Cabal introduces unnecessary package dependences, which in one case
> causes a Cabal build to fail whereas ghc --make does not fail.  I'm
> not sure whether this should be considered a bug in Cabal.
> I'm trying to Cabalize a program.  The executable depends on a package
> that can be compiled (the GHC path), but not interpreted (the GHCi
> path).  Some of my source files use this compile-only package, and
> other files use Template Haskell.  TH code is passed to the
> interpreter.
> If I build using ghc --make, the TH interpreter loads only the
> packages needed by the current file.  This works because the
> interpreter only runs for source files that use TH, and no file uses
> both TH and the compile-only package.  If I build using Cabal,
> however, the TH interpreter attempts to load every package needed by
> the project, apparently because Cabal passes every package on the
> command line.  Compilation fails because the compile-only package
> cannot be loaded.
> Should I submit a bug report?

This is not a bug we can fix in Cabal, at least not before replacing the
build mechanism (which is to call ghc --make).

It might be worth reporting against ghc. One presumes that if ghc can
work out which packages are needed by a single module and load just
those ones for the TH stuff, then it can do the same when Cabal tells it
all the packages it is allowed to use.


More information about the cabal-devel mailing list