GenericPackageDescription and 'build-depends' field

Mikhail Glushenkov the.dead.shall.rise at
Thu Apr 24 14:27:34 UTC 2014


On 21 April 2014 13:47, Daniel Trstenjak <daniel.trstenjak at> wrote:
> On Thu, Apr 10, 2014 at 03:10:32AM +0200, Mikhail Glushenkov wrote:
>> IIRC it's what condtrees get simplified to after finalizePackageDescription.
> What's the reason for this?

Condtrees represent conditional blocks in the .cabal file. Example:

if impl(ghc):
   build-depends: a, b, c

If we know the flag assignment, we can simplify them. This is what
finalizePackageDescription does.

> Because it makes it a bit awkward to handle the different sections
> (library/executable/testsuite/benchmark) respectively their BuildInfos
> in a generic way.

If your function needs to work on GenericPackageDescriptions, you'll
have to traverse condtrees, like I do here:

If you only work with finalized PackageDescriptions, you can get away
with looking only at buildInfos.

More information about the cabal-devel mailing list