[Haskell-cafe] Compiler constraints in cabal

wren ng thornton wren at freegeek.org
Sat Nov 6 23:09:45 EDT 2010


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

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list