GHC 9.8.1 regression: sometimes can't define associated type family instance when reexported
Summary
GHC 9.8.1 seems to have regressed when defining an associated type family instance when importing the class and the associated type family separately from a reexporting module.
Steps to reproduce
Consider the following three modules
{-# LANGUAGE TypeFamilies #-}
module A (Foo (..)) where
class Foo a where
type Bar a
module AA (module A) where
import A
{-# LANGUAGE TypeFamilies #-}
module B where
import AA (Bar, Foo)
data X
instance Foo X where
type Bar X = X
Running ghc A.hs AA.hs B.hs
fails to compile since GHC 9.8.1, but compiles just fine with earlier GHC versions (at least GHC 9.6, 9.4, 8.10).
src/B.hs:10:8-10: error: [GHC-54721]
‘Bar’ is not a (visible) associated type of class ‘Foo’
|
10 | type Bar X = X
| ^^^
Note that this does not happen when replacing import AA (Bar, Foo)
in B
with import A (Bar, Foo)
or import AA (Foo(..))
.
Expected behavior
I think GHC 9.8.1 should be able to compile this without any errors.
Environment
- GHC version used: 9.8.1
- Operating System: NixOS
- System Architecture: x86_64-linux