[Haskell-cafe] Compiler constraints in cabal

Reiner Pope reiner.pope at gmail.com
Sat Nov 6 06:20:15 EDT 2010

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

As I understand it, using "impl(ghc >= 7.0)" won't achieve this.

The closest thing I can think of is to write my hmatrix-static.cabal
file for version 0.4 as:

> ...
> if impl(ghc < 7.0)
>    build-depends: nonexistant-package
> ...

so that cabal cannot satisfy the constraints for hmatrix-static-0.4
unless I have ghc >= 7.0.

This seems a little hacky, and I'm also not sure if it works. (I'm
finding it rather hard to test these ideas, because I don't want to
upload a new package to Hackage every time...)

All the best,

On 6 November 2010 19:24, wren ng thornton <wren at freegeek.org> wrote:
> On 11/6/10 3:13 AM, Ivan Lazar Miljenovic wrote:
>> On 6 November 2010 17:52, Reiner Pope<reiner.pope at gmail.com>  wrote:
>>> Ah, I hadn't thought of that. But doesn't the version of GHC change
>>> much more often than the version of base does?
>> Each major version of GHC has a different (major) version of base.
>> I think you can also say stuff like "ghc>= 6.10", but I'm not sure.
> The correct condition notation is: impl(ghc >= 6.10)
> --
> Live well,
> ~wren
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list