Skip to content

Wrong reported types for partial field selectors in HIE files

When using HLS to ask for the type of a partial field selector, the reported type is:

recSelError :: forall a. Addr# -> a

Example:

module Test (T(..)) where


data T = A | RecordSel { a :: Bool
                       , b :: String
                       , c :: Char }

Dumping the hie-file of the source above results in the following output:

scope: ModuleScope bound at: Test.hs:4:26,
                                                                                  record field declaration bound at: Test.hs:4:31-34})})}
                             Source: generated by ghc
                             {(annotations: {(ConPat, Pat), (GRHS, GRHS), (HsApp, HsExpr),
                                             (HsLit, HsExpr), (HsVar, HsExpr), (Match, Match),
                                             (VarPat, Pat), (WildPat, Pat), (XExpr, HsExpr)}), 
                              (types: [4, 1, 0, 5, 12]), 
                              (identifier info: {(name Control.Exception.Base.recSelError,  Details:  Just 12 {usage}), 
                                                 (name Test.RecordSel,  Details:  Nothing {usage}), 
                                                 (name Test.a,  Details:  Just 3 {LHS of a match group,
                                                                                  record field pattern match bound at: Test.hs:4:26})})}
                             

platform: macOs

ghc: 9.6.1

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