@@ -8,6 +8,7 @@ module Development.IDE.Types.Exports
8
8
rendered,
9
9
moduleNameText,
10
10
occNameText,
11
+ isDatacon,
11
12
createExportsMap,
12
13
createExportsMapMg,
13
14
createExportsMapTc,
@@ -87,40 +88,41 @@ moduleNameText' = decodeUtf8 . bytesFS . moduleNameFS
87
88
data IdentInfo = IdentInfo
88
89
{ name :: ! OccName
89
90
, parent :: ! (Maybe OccName )
90
- , isDatacon :: ! Bool
91
91
, identModuleName :: ! ModuleName
92
92
}
93
93
deriving (Generic , Show )
94
94
deriving anyclass Hashable
95
95
96
+ isDatacon :: IdentInfo -> Bool
97
+ isDatacon = isDataOcc . name
98
+
96
99
instance Eq IdentInfo where
97
100
a == b = name a == name b
98
101
&& parent a == parent b
99
- && isDatacon a == isDatacon b
100
- && moduleNameText a == moduleNameText b
102
+ && identModuleName a == identModuleName b
101
103
102
104
instance NFData IdentInfo where
103
105
rnf IdentInfo {.. } =
104
106
-- deliberately skip the rendered field
105
- rnf name `seq` rnf parent `seq` rnf isDatacon `seq` rnf moduleNameText
107
+ rnf name `seq` rnf parent `seq` rnf identModuleName
106
108
107
109
mkIdentInfos :: ModuleName -> AvailInfo -> [IdentInfo ]
108
110
mkIdentInfos mod (AvailName n) =
109
- [IdentInfo (nameOccName n) Nothing (isDataConName n) mod ]
111
+ [IdentInfo (nameOccName n) Nothing mod ]
110
112
mkIdentInfos mod (AvailFL fl) =
111
- [IdentInfo (nameOccName n) Nothing (isDataConName n) mod ]
113
+ [IdentInfo (nameOccName n) Nothing mod ]
112
114
where
113
115
n = flSelector fl
114
116
mkIdentInfos mod (AvailTC parent (n: nn) flds)
115
117
-- Following the GHC convention that parent == n if parent is exported
116
118
| n == parent
117
- = [ IdentInfo (nameOccName n) (Just $! nameOccName parent) (isDataConName n) mod
119
+ = [ IdentInfo (nameOccName n) (Just $! nameOccName parent) mod
118
120
| n <- nn ++ map flSelector flds
119
121
] ++
120
- [ IdentInfo (nameOccName n) Nothing (isDataConName n) mod ]
122
+ [ IdentInfo (nameOccName n) Nothing mod ]
121
123
122
124
mkIdentInfos mod (AvailTC _ nn flds)
123
- = [ IdentInfo (nameOccName n) Nothing (isDataConName n) mod
125
+ = [ IdentInfo (nameOccName n) Nothing mod
124
126
| n <- nn ++ map flSelector flds
125
127
]
126
128
@@ -177,7 +179,7 @@ createExportsMapHieDb withHieDb = do
177
179
where
178
180
wrap identInfo = (rendered identInfo, Set. fromList [identInfo])
179
181
-- unwrap :: ExportRow -> IdentInfo
180
- unwrap m ExportRow {.. } = IdentInfo exportName exportParent exportIsDatacon m
182
+ unwrap m ExportRow {.. } = IdentInfo exportName exportParent m
181
183
182
184
unpackAvail :: ModuleName -> IfaceExport -> [(Text , Text , [IdentInfo ])]
183
185
unpackAvail mn
0 commit comments