Skip to content

hs-boot file handling is not quite correct

Looking at GHC.Unit.Types.hs-boot you see:

data UnitId
data GenModule unit
data GenUnit uid
data Indefinite unit

What is the kind of GenModule? The inferred kind is k -> * with -XGHC2021 so the hs-boot file decides that's the kind of GenModule.

Looking in GHC.Unit.Types.hs, the definition is

 data GenModule unit = Module                                                    
    { moduleUnit :: !unit       -- ^ Unit the module belongs to                  
    , moduleName :: !ModuleName -- ^ Module name (e.g. A.B.C)                    
    }                                                                            
    deriving (Eq,Ord,Data,Functor)

do the inferred kind of GenModule is * -> *. Which is not the same as the kind declared in the hs-boot file, so there should be an error.

The root cause of this issue is the same as #12035 (closed) I think, but the fix there was not general enough.

The reason I found this, is that I have a patch which fixed this bug and it failed to compile this module when testing my patch building GHC.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information