Cabal: Build failure with GHC 8.0.1

Created on 26 Sep 2017  Â·  11Comments  Â·  Source: haskell/cabal

I tried to new-build Cabal afresh and I got this error:

[ 65 of 203] Compiling Distribution.Types.UnitId ( Distribution/Types/UnitId.hs, /srv/code/cabal-shake/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-2.1.0.0/noopt/build/Distribution/Types/UnitId.o )

Distribution/Types/UnitId.hs:124:75: error:
    • Couldn't match representation of type ‘forall s2.
                                             P.Parsec
                                               s2 [Distribution.Parsec.Common.PWarning] UnitId’
                               with that of ‘P.Parsec
                                               s1 [Distribution.Parsec.Common.PWarning] DefUnitId’
        arising from a use of ‘ghc-prim-0.5.0.0:GHC.Prim.coerce’
      The data constructor ‘Text.Parsec.Prim.ParsecT’
        of newtype ‘P.ParsecT’ is not in scope
    • In the expression:
          ghc-prim-0.5.0.0:GHC.Prim.coerce
            (parsec ::
               P.Parsec s ([] Distribution.Parsec.Common.PWarning) UnitId) ::
            ParsecParser DefUnitId
      In an equation for ‘parsec’:
          parsec
            = ghc-prim-0.5.0.0:GHC.Prim.coerce
                (parsec ::
                   P.Parsec s ([] Distribution.Parsec.Common.PWarning) UnitId) ::
                ParsecParser DefUnitId
      When typechecking the code for ‘parsec’
        in a derived instance for ‘Parsec DefUnitId’:
        To see the code I am typechecking, use -ddump-deriv
      In the instance declaration for ‘Parsec DefUnitId’

Distribution/Types/UnitId.hs:124:75: error:
    • Couldn't match representation of type ‘forall s2.
                                             P.Parsec
                                               s2 [Distribution.Parsec.Common.PWarning] UnitId’
                               with that of ‘P.Parsec
                                               s1 [Distribution.Parsec.Common.PWarning] DefUnitId’
        arising from a use of ‘ghc-prim-0.5.0.0:GHC.Prim.coerce’
      The data constructor ‘Text.Parsec.Prim.ParsecT’
        of newtype ‘P.ParsecT’ is not in scope
    • In the expression:
          ghc-prim-0.5.0.0:GHC.Prim.coerce
            (lexemeParsec ::
               P.Parsec s ([] Distribution.Parsec.Common.PWarning) UnitId) ::
            ParsecParser DefUnitId
      In an equation for ‘lexemeParsec’:
          lexemeParsec
            = ghc-prim-0.5.0.0:GHC.Prim.coerce
                (lexemeParsec ::
                   P.Parsec s ([] Distribution.Parsec.Common.PWarning) UnitId) ::
                ParsecParser DefUnitId
      When typechecking the code for ‘lexemeParsec’
        in a derived instance for ‘Parsec DefUnitId’:
        To see the code I am typechecking, use -ddump-deriv
      In the instance declaration for ‘Parsec DefUnitId’

Oddly, there was no complaint from CI, so I am not sure what is going on...

Most helpful comment

Or, I can re/write the instance explicitly, without GND too.

All 11 comments

/cc @phadej

So I did this:

$ rm -rf dist
$ rm -rf dist-newstyle 
$ cabal new-build -w ghc-8.0.2 all

on current master and it compiled fine. Maybe you're running a dev snapshot of GHC or using non-default flags to compile Cabal?

Oh! I compiled with 8.0.1

Could reproduce with 8.0.1, but not 8.2.1 or 8.0.2. Not sure whether we should care, since it looks like a bug in the GHC's deriving implementation.

looks like a bug in the GHC's deriving implementation.

Possibly GHC#12616, which was fixed in 8.0.2.

@23Skidoo we could add something like

if impl(ghc == 8.0.1)
   build-depends: cabal-issue4793 < 0

to the .cabal file...

this has the benefit of the cabal solver avoiding picking Cabal-2.1 for GHC 8.0.1 (and instead backtracking), as well as giving a more obvious hint to the user right away when trying to build Cabal from Git with ghc-8.0.1:

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: Cabal-2.1.0.0 (user goal)
unknown package: cabal-issue4793 (dependency of Cabal-2.1.0.0)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: Cabal, cabal-issue4793

Or, I can re/write the instance explicitly, without GND too.

I'm happy to wait and see if anyone else reports this problem before we do anything. It is suboptimal for Cabal to not build on all versions of GHC but OTOH if no one is actually using this GHC (I just have a rickety old install I should update) then let's not bother.

@ezyang

OTOH if no one is actually using this GHC

Guess which version of GHC Debian chose to include in Debian 9 "Stretch"? ;-)

https://packages.debian.org/stretch/ghc

:) :) :)

@ezyang also @dmwit asked about it on IRC today...

Was this page helpful?
0 / 5 - 0 ratings