[Haskell-cafe] Compiler constraints in cabal

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Sat Nov 13 14:17:41 EST 2010

Hash: SHA1

On 11/6/10 23:09 , wren ng thornton wrote:
> On 11/6/10 6:20 AM, Reiner Pope wrote:
>> I was aware of this condition, but I'm not precisely sure it addresses
>> my requirements. When you run "cabal install some-package", cabal
>> reads all version constraints listed in the "build-depends" field, and
>> chooses which versions of which packages to download from Hackage in
>> order to satisfy these constraints.
>> I want to expose my dependency on a particular version of ghc to
>> cabal's constraint satisfier. The end result I want is that when you
>> type "cabal install hmatrix-static" with ghc-6.12 installed, then
>> cabal chooses hmatrix-static-0.3; and when you type "cabal install
>> hmatrix-static" with ghc-7.0 installed, then cabal chooses
>> hmatrix-static-0.4.
> Clients of hmatrix-static would have to say
>     if impl(ghc >= 7.0)
>         Build-Depends: hmatrix-static == 0.4.*
>     else
>         Build-Depends: hmatrix-static == 0.3.*
> in order to pull in the right dependency for themselves.
> In order to get the behavior you're after, though, is trickier business.
> Since every version of GHC ships with a different version of base, you'll
> have to make use of that knowledge such that users of ghc-7.0 with base-5
> will get hmatrix-static-0.4 whereas users of ghc-6.12 with base-4 will get
> hmatrix-static-0.3

Don't you just rerelease 0.3.x (bump the sub-version) with a dependency on
base < 5, and release 0.4 with base = 5, and let Cabal work out the above
Build-Depends for itself?

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the Haskell-Cafe mailing list