MIN_VERSION_foo() macro vs. CABAL-flag directed API-adaption
Henning Thielemann
lemming at henning-thielemann.de
Tue Sep 18 13:05:47 CEST 2012
On Tue, 18 Sep 2012, Herbert Valerio Riedel wrote:
> Hello,
>
> When I noticed the recently released HTTP-4000.2.5[1] package used a
> CABAL-flag based approach[2] for what I expected the use of a macro
> MIN_VERSION_network(2,4,0) to be more appropriate (see [3]), I wasn't
> totally sure whether there was any down-side with the
> MIN_VERSION_-approach. So my question is:
>
> 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 prefer the Cabal approach since it requires one (hacky) tool less in the
tool chain. I use different Hs-Source-Dirs depending on a Cabal flag. With
ghci you can choose the different modules using the -i option.
More information about the Libraries
mailing list