[Haskell-cafe] Cabal and more than one version
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Mon Feb 2 21:03:53 EST 2009
On Mon, 2009-02-02 at 13:18 +0100, Sean Leather wrote:
> Either I'm doing something wrong or this doesn't work for
> cabal-install and GHC 6.8.3. I used the "flag newer-th" approach in
> EMGM:
>
>
> https://svn.cs.uu.nl:12443/viewvc/dgp-haskell/EMGM/tags/emgm-0.2/emgm.cabal?view=markup
>
> [...]
>
> flag th23
> description: Define a CPP flag that enables conditional compilation
> for template-haskell package version 2.3 and newer.
>
> Library
>
> [...]
>
> build-depends: base >= 3.0 && < 4.0,
> template-haskell < 2.4
>
> -- Include deriveRep for Loc. This was introduced with
> -- template-haskell-2.3, included with GHC 6.10.
> if flag(th23)
> build-depends: template-haskell >= 2.3
> cpp-options: -DTH_LOC_DERIVEREP
> else
> build-depends: template-haskell < 2.3
>
> [...]
>
> When I run cabal install emgm (with GHC 6.8.3 and either Cabal 1.2 or
> 1.6), it tries (and fails) to install template-haskell-2.3. That's
> exactly what I don't want. Any suggestions?
No immediate workarounds, though you could perhaps try reversing the
condition or the default of the flag. Though that might just reverse the
problem case.
Presumably the template-haskell-2.3 package does not build with ghc-6.8
but fails to correctly specify the version of base or ghc that it
requires. If it did then we would have a better chance to get this
right.
In general this is going to be hard. The solver is not that smart and it
deliberately does no backtracking (as a defence against searching too
much given that it has no smart methods for pruning the search space).
This is just the kind of situation where we need a proper solver which
is probably a couple months work.
Another possible workaround...
If you avoid using the flag hack then the solver would not have to
choose so early which version of template-haskell to commit to and it
would be able to pick the right version later. Though then you need an
alternative method of finding which version of template-haskell you
ended up with. You could do it with some custom code in Setup.hs.
Duncan
More information about the Haskell-Cafe
mailing list