type family consistency checks, interaction with hs-boot files
It's not clear to me how the type family consistency check should interact with hs-boot files.
In particular, what if an hs-boot file has an import that the hs file doesn't have?
This sets up the situation where A.hs and C.hs have conflicting definitions. A.hs and A.hs-boot have different imports, A.hs-boot imports C but A.hs does not. Then when consistency is checked for A.hs
we error about inconsistency with C
.
-- T.hs
{-# LANGUAGE TypeFamilies #-}
module T where
type family T a
-- C.hs
{-# LANGUAGE TypeFamilies #-}
module C where
import T
type instance T Int = Int
-- A.hs-boot
{-# LANGUAGE TypeFamilies #-}
module A where
import T
import C
-- A.hs
{-# LANGUAGE TypeFamilies #-}
module A where
import T
data A = A
type instance T Int = ()
Now GHC reports:
A.hs:1:1: error: [GHC-34447]
Conflicting family instance declarations:
T Int = Int -- Defined in module C
T Int = () -- Defined at A.hs:8:15
|
1 | {-# LANGUAGE TypeFamilies #-}
| ^
But A
doesn't import C
so it's unclear to me why this is an error.
Any thoughts @simonpj @sheaf @adamgundry ?