AvailTC Invariant being violated
The AvailTC Invariant
(from basicTypes/Avail.hs
) states that:
If the type or class is itself
to be in scope, it must be
*first* in this list. Thus,
typically: @AvailTC Eq [Eq, ==, \/=]@
Here is a case where this invariant is not upheld:
-
pkgA/pkgA.cabal
:
name: pkgA
version: 1.0.0
build-type: Simple
cabal-version: >= 1.2
library
exposed-modules: A
build-depends: base
pkgA/A.hs
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeFamilies #-}
module A
( C(..)
, T(TI)
, error
) where
class C a where
data T a
instance C Int where
data T Int = TI { ti :: Int }
pkgB/pkgB.cabal
name: pkgB
version: 1.0.0
build-type: Simple
cabal-version: >= 1.2
library
exposed-modules: B
build-depends: base, pkgA
pkgB/B.hs
module B
( module A
) where
import A hiding (error)
Now, check out the exports for A
vs. B
:
$ cabal new-build pkgA pkgB --ghc-options -ddump-rn-trace | grep rnExports
Warning: The package list for 'hackage.haskell.org' is 38 days old.
Run 'cabal update' to get the latest list of available packages.
rnExports: Exports: [error, C{C, T;}, T{T, TI;}]
rnExports: Exports: [C{C, T;}, T{TI;}]
Why is T{TI;}
in the second line not T{T, TI;}
? Shouldn't the exports for B
be identical to those for A
(except for error
)?
This is causing a crash in Haddock: https://github.com/haskell/haddock/issues/979.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |