MIN_VERSION_foo() macro vs. CABAL-flag directed API-adaption
sol at typeful.net
Tue Sep 18 12:59:53 CEST 2012
On Tue, Sep 18, 2012 at 12:41:50PM +0200, Herbert Valerio Riedel wrote:
> Is it always desirable to prefer the MIN_VERSION_ approach over a
> CABAL-flag approach for supporting multiple API versions of a
> dependent package (if both ways are possible)? And if not, when
> should I prefer which approach?
I'm not aware of any advantages of Cabal-flags over MIN_VERSION.
If you use MIN_VERSION you can put
:set -optP-include -optPdist/build/autogen/cabal_macros.h
into a .ghci, and included it in the packages repository. That way you
can use GHCi when developing on that package, without passing any CPP
flags explicitly**. For that reason I prefer the MIN_VERSION-approach.
** An initial `cabal configure && cabal build` is still required, so
that cabal_macros.h is generated.
More information about the Libraries