HatAna.hs revision e9458b1a7a19a63aa4c179f9ab20f4d50681c168
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
1837N/AModule : ./Haskell/HatAna.hs
1837N/ALicense : GPLv2 or higher, see LICENSE.txt
1837N/Aimport Haskell.HatParser hiding (hatParser)
1837N/Aimport Haskell.PreludeString
1837N/Aimport Common.AS_Annotation
1837N/Aimport Common.Result
1837N/Aimport Common.Doc
1837N/Aimport Common.DocUtils
1837N/Aimport Common.ExtSign
1837N/Aimport Data.Maybe (fromMaybe)
1837N/A , Map.keysSet $ fixities a, length $ instances a)
1837N/A , Map.keysSet $ fixities b, length $ instances b)
1837N/A , types = types e1 `Map.difference` types e2
1837N/A , values = values e1 `Map.difference` values e2
1837N/A , fixities = fixities e1 `Map.difference` fixities e2
1837N/A , scope = scope e1 `DSet.union` scope e2
(if Map.null ts then empty else
[ a :>: b | (a, b) <- Map.toList ts ])) $+$
(if Map.null vs then empty else
[ a :>: b | (a, b) <- Map.toList vs ])) $+$
(if Map.null fs then empty else
| (a, b) <- Map.toList fs ]) $+$
, types = Map.fromList [ (a, b) | (a :>: b) <- ts ]
, values = Map.fromList [ (a, b) | (a :>: b) <- vs ]
, fixities = Map.fromList fs
, types = Map.empty
, values = Map.empty
, fixities = Map.empty
osc = scope e `DSet.union` insc
rm = reAssocModule wm [(mod_Prelude, Map.toList fixMap)] parsedMod
. extendts [ a :>: b | (a, b) <- Map.toList $ values e ]
. extendkts [ a :>: b | (a, b) <- Map.toList $ types e ]
getHsDecl = Data.Maybe.fromMaybe (HsFunBind loc0 []) . basestruct . struct
HsTypeSig _ ts _ _ -> any (flip Set.member preludeValues . pp) ts
HsTypeDecl _ ty _ -> Set.member (pp $ definedType ty) preludeTypes
HsDataDecl _ _ ty cs _ -> Set.member (pp $ definedType ty) preludeTypes
Set.member s preludeValues || prefixed s
in Set.member s preludeConstrs
preludeValues :: Set.Set String
preludeValues = Set.fromList $ filter (not . prefixed) $ map pp
$ Map.keys $ values preludeSign
preludeConstrs :: Set.Set String
Set.filter ( \ s -> not (null s) && isUpper (head s)) preludeValues
preludeTypes :: Set.Set String