CPP confusion

Ian Lynagh igloo at earth.li
Tue Oct 16 18:30:03 EDT 2007

[can we keep this on just one mailing list please? cabal-devel@ makes
most sense to me]

On Tue, Oct 16, 2007 at 10:46:26AM +0100, Duncan Coutts wrote:
> The latest thing I've stumbled over is HsUnix.h in ghc-6.8. This header
> file is for defines to use when pre-processing Haskell code. It used to
> live in the global $GHCLIBDIR/include but now lives in the include dir
> for the unix package. This is probably the right thing to do, however...
> How do packages that want to use this include actually use it? If they
> #include it directly in a .hs file then it'll work since ghc -package
> unix adds the unix package's include dir to the search path. But what if
> someone needs to use it in a .hsc file?
> Well, then it does not work. It does not work because Cabal does not
> pass these include directories to hsc2hs

Is there a reason we can't just fix that, and pass hsc2hs "-Ifoo" for
each includes directory "foo" in a package we depend on?

> In fact this totally relies on a package
> database to remember what search directories to use when pre-processing
> dependent packages. In other words it only has a chance of working with
> ghc at the moment, or nhc in future if/when it implements a package
> database.

Yes, I think that at some point all impls will need some sort of package
database (or perhaps Cabal could manage a package database itself for
some or all impls?).


More information about the cabal-devel mailing list