[Haskell-cafe] Cabal

Duncan Coutts duncan.coutts at googlemail.com
Mon Nov 9 07:39:10 EST 2009

On Sun, 2009-11-08 at 20:47 -0800, Gregory Crosswhite wrote:
> Actually, let me clarify my point:  I have rarely encountered problems
> when using Cabal as a package distribution system, but I have run into
> problems when using it as a build system in a non-trivial manner.  For
> example, when I wanted to build a lot of small utility programs I
> found that it was re-compiling commonly-shared source files for each
> program, rather than compiling the source file once and re-using the
> object file.  This was sufficiently annoying that I migrated the build
> process of my utilities to scons.

You'll be glad to know this is addressed in Cabal-1.8, though not in a
fully automatic way. The problem with sharing automatically is knowing
when it is safe to do so and when it is not. Each component that shares
a source file can use different compiler options, cpp flags, and include
dirs (and perhaps other stuff that we cannot easily track). Also, when
you link it into a library you actually compile it differently than when
you compile it into an executable (the -package-name flag is different).

So what we've done is to let executables depend on libraries. That makes
the sharing explicit. At some point I also want to add support for
private libs which would make this feature useful in more cases.


More information about the Haskell-Cafe mailing list