
wren ng thornton schrieb:
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.
Awful - I would not like to complicate my Cabal files this way. This is like copying the Build-Depends enumeration to all depending packages.
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
I would not like this solution, too, since this assumes, that 'base' is a GHC-specific library and I hope this will be no longer true in the future. Does the LanguageExtensions field prevent building a package, if the installed compiler cannot handle that? I'm afraid, LanguageExtensions is just a list of flags that is passed to GHC. But it sounds like a good idea, if Cabal would also check, whether the used compiler supports the required LanguageExtensions at all.