[Haskell-cafe] Cabal version constraint seems to be ignored.

Carlo Hamalainen carlo at carlo-hamalainen.net
Wed Jan 22 12:43:34 UTC 2014


I have two versions of Cabal, both are visible:

$ ghc-pkg expose Cabal-1.16.0
$ ghc-pkg expose Cabal-

I clone and build my package. Since I have GHC 7.6.3 it uses
Cabal-1.16.0 (as specified in ghc-imported-from.cabal):

$ git clone https://github.com/carlohamalainen/ghc-imported-from
$ cd ghc-imported-from
$ cabal install

It looks like Cabal-1.16.0 was chosen, as expected:

$ grep Cabal dist/build/autogen/cabal_macros.h
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package Cabal-1.16.0 */
#define VERSION_Cabal "1.16.0"
#define MIN_VERSION_Cabal(major1,major2,minor) (\

But my program doesn't run:

$ ghc-imported-from src/Main.hs Main getArgs 11 11 --ghc-options
GhcOptions []
GhcPkgOptions []

    Couldn't match expected type `Distribution.PackageDescription.BuildInfo'
                with actual type
    In the fourth argument of `getGHCOptions', namely `binfo'
    In a stmt of a 'do' block:
      getGHCOptions [] c (fromJust $ cradleCabalDir c) binfo
    In the expression:
      do { c <- findCradle;
           pkgDesc <- GhcMonad.liftIO
                      $ parseCabalFile $ fromJust $ cradleCabalFile c;
           let binfo = head $ cabalAllBuildInfo pkgDesc;
           getGHCOptions [] c (fromJust $ cradleCabalDir c) binfo }

I'm surprised that the error didn't appear at compile time. I guess the
first reference to Distribution.PackageDescription.BuildInfo is from

If I hide Cabal- then things work ok:

$ ghc-pkg hide Cabal-
$ cabal install
$ ghc-imported-from .... (runs as expected)

But I can't expect a user to know that they have to hide Cabal-

Is this actually a GHC bug or have I stuffed up my
ghc-imported-from.cabal file?


Carlo Hamalainen

More information about the Haskell-Cafe mailing list