Backpack signatures fail to compile when referencing class associated types with defaults
Summary
Backpack signatures fail to compile when they reference class associated types with default definitions.
Steps to reproduce
Build a library that contains a class associated type along with a default definition and require an instance of that class in a backpack signature.
Example:
backpack-test.cabal
:
cabal-version: 2.4
name: backpack-test
version: 0
library common
build-depends: base
default-language: Haskell2010
exposed-modules: Class
hs-source-dirs: common
library consumer
build-depends: base, common
default-language: Haskell2010
signatures: Instance
hs-source-dirs: consumer
common/Class.hs
:
{-# language TypeFamilies #-}
module Class where
class C x where
type T x
type T x = ()
consumer/Instance.hsig
:
signature Instance where
import Class
data I
instance C I
Error given:
<no location info>: error:
The identifier R:TI does not exist in the local signature.
(Try adding it to the export list of the hsig file.)
Note: Removing the default type T x = ()
results in this code compiling.
Expected behavior
I'd expect this to work.
Environment
- GHC version used: 8.8
Optional:
- Operating System: All
- System Architecture: All
Edited by Edward Kmett