[GHC] #16077: AvailTC Invariant being violated
GHC
ghc-devs at haskell.org
Thu Dec 20 20:37:04 UTC 2018
#16077: AvailTC Invariant being violated
-------------------------------------+-------------------------------------
Reporter: harpocrates | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.3
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16077>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list