[Haskell-cafe] ANN: HDBC v2.0 now available

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Feb 1 09:43:15 EST 2009


On Fri, 2009-01-30 at 18:31 -0600, John Goerzen wrote:

> I can't hard-code base >= 4 into .cabal because that would break for
> GHC 6.8 users.  I have CPP code that selects what to compile based on
> GHC version.

Ahh, but the version of base is no longer determined by the version of
GHC, so using cpp tests on the ghc version is not right (besides it does
not work for non-ghc if that is relevant).

In future (from Cabal-1.6 onwards) you can use macros to test the
version of the package rather than the version of ghc:

#if MIN_VERSION_base(4,0,0)
...
#endif

but since you are trying to support ghc-6.8 (and Cabal-1.2) you cannot
rely on these macros yet. You can use this trick:

flag base4

library
  if flag(base4)
    build-depends: base >= 4
    cpp-options:   -DBASE4
  else
    build-depends: base < 4

Duncan



More information about the Haskell-Cafe mailing list