bend-lint 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,18 @@
1
1
  # The program seam.ts writes from bend-lint.json calls `run` with its rules: `Cli.run(~[Cli.Rule{"x", X.rule()}])`.
2
2
  import Base
3
- import ../files/main.bend as Files
4
- import ../json/main.bend as Json
5
- import bend-lint-api@0.2.1.0/shared/lists.bend as Lists
6
- import bend-lint-api@0.2.1.0/shared/names.bend as Names
7
- import bend-lint-api@0.2.1.0/shared/sets.bend as Sets
8
- import ../text/main.bend as Text
9
- import ./directives.bend as Directives
10
- import ./fixes.bend as Fixes
11
- import bend-lint-api@0.2.1.0/linter/lint.bend as Lint
3
+ import bend-lint-api@0.3.0.0/shared.bend as Shared
4
+ import bend-lint-api@0.3.0.0/linter/api/impl.bend as LintImpl
5
+ import bend-lint-api@0.3.0.0/linter/api/spec.bend as Lint
6
+ import ./directives/impl.bend as DirectivesImpl
7
+ import ./directives/spec.bend as Directives
8
+ import ./shared/files/impl.bend as FilesImpl
9
+ import ./shared/files/spec.bend as Files
10
+ import ./shared/fixes/impl.bend as FixesImpl
11
+ import ./shared/fixes/spec.bend as Fixes
12
+ import ./shared/json/impl.bend as JsonImpl
13
+ import ./shared/json/spec.bend as Json
14
+ import ./shared/text/impl.bend as TextImpl
15
+ import ./shared/text/spec.bend as Text
12
16
 
13
17
  # Errors
14
18
  # ======
@@ -24,9 +28,9 @@ def Error.json(+path: String, text: String) -> Json.Json:
24
28
  Json.JArray{
25
29
  [
26
30
  Json.JObject{
27
- Lists.push(
31
+ Shared.Lists.push(
28
32
  Json.JField,
29
- Lists.when(
33
+ Shared.Lists.when(
30
34
  Json.JField,
31
35
  Bool.not(String.is_empty(path)),
32
36
  Json.JField{"path", Json.JString{path}}
@@ -57,26 +61,26 @@ def Error.end(-A: Type, json: Bool, status: U32, path: String, +text: String) ->
57
61
  # values. Before a run, the runner checks the values against what the rule declares, and adds the defaults.
58
62
  type Setting is Data:
59
63
  RuleOff{}
60
- RuleOn{severity: Maybe<&2, Lint.Severity>, options: List<&2, Names.Named<Lint.Value>>}
64
+ RuleOn{severity: Maybe<&2, Lint.Severity>, options: List<&2, Shared.Names.Named<Lint.Value>>}
61
65
 
62
66
  type Project is Data:
63
67
  Project{
64
68
  entries: List<&2, String>,
65
69
  imports: Maybe<&2, Bool>,
66
- rules: List<&2, Names.Named<Setting>>
70
+ rules: List<&2, Shared.Names.Named<Setting>>
67
71
  }
68
72
 
69
73
  def Setting.severities(
70
- names: List<&2, Names.Named<Lint.Severity>>
71
- ) -> List<&2, Names.Named<Setting>>:
74
+ names: List<&2, Shared.Names.Named<Lint.Severity>>
75
+ ) -> List<&2, Shared.Names.Named<Setting>>:
72
76
  match names:
73
77
  case Nil{}:
74
78
  []
75
- case Con{Names.Named{name, severity}, rest}:
76
- Names.Named{name, RuleOn{Some{severity}, []}} <> Setting.severities(rest)
79
+ case Con{Shared.Names.Named{name, severity}, rest}:
80
+ Shared.Names.Named{name, RuleOn{Some{severity}, []}} <> Setting.severities(rest)
77
81
 
78
- def Setting.names() -> List<&2, Names.Named<Setting>>:
79
- Names.Named{"off", RuleOff{}} <> Setting.severities(Lint.Severity.names())
82
+ def Setting.names() -> List<&2, Shared.Names.Named<Setting>>:
83
+ Shared.Names.Named{"off", RuleOff{}} <> Setting.severities(Lint.Severity.names())
80
84
 
81
85
  def Parsed.entry(folder: String, item: Json.Json) -> Maybe<&2, String>:
82
86
  match item:
@@ -115,22 +119,22 @@ def Parsed.option(
115
119
  severity: Bool,
116
120
  key: String,
117
121
  value: Json.Json,
118
- out: Maybe<&2, List<&2, Names.Named<Lint.Value>>>
119
- ) -> Maybe<&2, List<&2, Names.Named<Lint.Value>>>:
122
+ out: Maybe<&2, List<&2, Shared.Names.Named<Lint.Value>>>
123
+ ) -> Maybe<&2, List<&2, Shared.Names.Named<Lint.Value>>>:
120
124
  match severity:
121
125
  case True{}:
122
126
  out
123
127
  case False{}:
124
- do Maybe<&2, List<&2, Names.Named<Lint.Value>>>:
125
- values: List<&2, Names.Named<Lint.Value>> <- out
128
+ do Maybe<&2, List<&2, Shared.Names.Named<Lint.Value>>>:
129
+ values: List<&2, Shared.Names.Named<Lint.Value>> <- out
126
130
  v: Lint.Value <- Parsed.value(value)
127
- return Names.Named{key, v} <> values
131
+ return Shared.Names.Named{key, v} <> values
128
132
 
129
133
  # The option values of a rule's object, last first: every field but "severity".
130
134
  def Parsed.options(
131
135
  fields: List<&2, Json.JField>,
132
- out: Maybe<&2, List<&2, Names.Named<Lint.Value>>>
133
- ) -> Maybe<&2, List<&2, Names.Named<Lint.Value>>>:
136
+ out: Maybe<&2, List<&2, Shared.Names.Named<Lint.Value>>>
137
+ ) -> Maybe<&2, List<&2, Shared.Names.Named<Lint.Value>>>:
134
138
  match fields:
135
139
  case Nil{}:
136
140
  out
@@ -149,7 +153,7 @@ def Parsed.severity.of(
149
153
  Lint.Severity,
150
154
  Maybe<&2, Lint.Severity>,
151
155
  sev => Some{sev},
152
- Names.lookup(Lint.Severity, s, Lint.Severity.names())
156
+ Shared.Names.lookup(Lint.Severity, s, Lint.Severity.names())
153
157
  )
154
158
  case True{} _:
155
159
  None{}
@@ -168,34 +172,37 @@ def Parsed.severity(
168
172
  Parsed.severity(rest, Parsed.severity.of(String.eq(key, "severity"), value, found))
169
173
 
170
174
  # A rule's setting: "off", a severity, or an object of a severity (if any) and option values.
171
- def Parsed.rule(field: Json.JField) -> Maybe<&2, Names.Named<Setting>>:
175
+ def Parsed.rule(field: Json.JField) -> Maybe<&2, Shared.Names.Named<Setting>>:
172
176
  match field:
173
177
  case Json.JField{id, Json.JString{s}}:
174
178
  Maybe.map(
175
179
  &2,
176
180
  Setting,
177
- Names.Named<Setting>,
178
- setting => Names.Named{id, setting},
179
- Names.lookup(Setting, s, Setting.names())
181
+ Shared.Names.Named<Setting>,
182
+ setting => Shared.Names.Named{id, setting},
183
+ Shared.Names.lookup(Setting, s, Setting.names())
180
184
  )
181
185
  case Json.JField{+id, Json.JObject{+fields}}:
182
- do Maybe<&2, Names.Named<Setting>>:
186
+ do Maybe<&2, Shared.Names.Named<Setting>>:
183
187
  severity: Maybe<&2, Lint.Severity> <- Parsed.severity(fields, Some{None{}})
184
- options: List<&2, Names.Named<Lint.Value>> <- Parsed.options(fields, Some{[]})
185
- return Names.Named{id, RuleOn{severity, List.reverse(&2, Names.Named<Lint.Value>, options)}}
188
+ options: List<&2, Shared.Names.Named<Lint.Value>> <- Parsed.options(fields, Some{[]})
189
+ return Shared.Names.Named{
190
+ id,
191
+ RuleOn{severity, List.reverse(&2, Shared.Names.Named<Lint.Value>, options)}
192
+ }
186
193
  case _:
187
194
  None{}
188
195
 
189
196
  def Parsed.rules(
190
197
  fields: List<&2, Json.JField>,
191
- out: List<&2, Names.Named<Setting>>
192
- ) -> Maybe<&2, List<&2, Names.Named<Setting>>>:
198
+ out: List<&2, Shared.Names.Named<Setting>>
199
+ ) -> Maybe<&2, List<&2, Shared.Names.Named<Setting>>>:
193
200
  match fields:
194
201
  case Nil{}:
195
- Some{List.reverse(&2, Names.Named<Setting>, out)}
202
+ Some{List.reverse(&2, Shared.Names.Named<Setting>, out)}
196
203
  case Con{f, rest}:
197
- do Maybe<&2, List<&2, Names.Named<Setting>>>:
198
- r: Names.Named<Setting> <- Parsed.rule(f)
204
+ do Maybe<&2, List<&2, Shared.Names.Named<Setting>>>:
205
+ r: Shared.Names.Named<Setting> <- Parsed.rule(f)
199
206
  Parsed.rules(rest, r <> out)
200
207
 
201
208
  # A key of the config. The server reads packages, as it writes the program, so the runner takes any value of it.
@@ -205,12 +212,12 @@ type Key is Data:
205
212
  Rules{}
206
213
  Packages{}
207
214
 
208
- def Key.names() -> List<&2, Names.Named<Key>>:
215
+ def Key.names() -> List<&2, Shared.Names.Named<Key>>:
209
216
  [
210
- Names.Named{"entries", Entries{}},
211
- Names.Named{"imports", Imports{}},
212
- Names.Named{"rules", Rules{}},
213
- Names.Named{"packages", Packages{}}
217
+ Shared.Names.Named{"entries", Entries{}},
218
+ Shared.Names.Named{"imports", Imports{}},
219
+ Shared.Names.Named{"rules", Rules{}},
220
+ Shared.Names.Named{"packages", Packages{}}
214
221
  ]
215
222
 
216
223
  def Parsed.set(
@@ -244,7 +251,7 @@ def Parsed.set(
244
251
  Result<&2, &2, String, Project>,
245
252
  Maybe.map(
246
253
  &2,
247
- List<&2, Names.Named<Setting>>,
254
+ List<&2, Shared.Names.Named<Setting>>,
248
255
  Result<&2, &2, String, Project>,
249
256
  rs => Done{Project{entries, imports, rs}},
250
257
  Parsed.rules(fields, [])
@@ -274,7 +281,7 @@ def Parsed.field(
274
281
  Fail{why}
275
282
  case Json.JField{+key, value} Done{Project{entries, imports, rules}}:
276
283
  Parsed.set(
277
- Names.lookup(Key, key, Key.names()),
284
+ Shared.Names.lookup(Key, key, Key.names()),
278
285
  key,
279
286
  folder,
280
287
  value,
@@ -300,7 +307,67 @@ def Parsed.of(folder: String, json: Maybe<&2, Json.Json>) -> Result<&2, &2, Stri
300
307
  case _:
301
308
  Fail{"not a JSON object"}
302
309
 
303
- # The config at `path`, if each of its entries is a file (`missing` lists those that are not); else the run ends.
310
+ # The paths the server holds an overlay for (`--overlays`, see seam.ts), one a line in BEND_LINT_OVERLAYS: none, if it
311
+ # gives none.
312
+ def Overlays.of(given: Result<&1, &1, U32 & String, String>) -> List<&2, String>:
313
+ match given:
314
+ case Done{text}:
315
+ List.filter(~String, ~(n => Bool.not(String.is_empty(n))), String.split(text, '\n'))
316
+ case Fail{why}:
317
+ []
318
+
319
+ # Whether `key` is one of `overlays`, or `found`.
320
+ def Overlays.has(overlays: List<&2, String>, +key: String, found: Bool) -> Bool:
321
+ match overlays found:
322
+ case _ True{}:
323
+ True{}
324
+ case Nil{} False{}:
325
+ False{}
326
+ case Con{o, rest} False{}:
327
+ Overlays.has(rest, key, String.eq(o, key))
328
+
329
+ # Whether an overlay gives the text of the file `name` in the folder whose real path is `real`: an overlay's key is
330
+ # its folder's real path, then its name (see seam.ts).
331
+ def Overlays.covers(
332
+ overlays: List<&2, String>,
333
+ real: Result<&1, &1, U32 & String, String>,
334
+ name: String
335
+ ) -> Bool:
336
+ match real:
337
+ case Done{folder}:
338
+ Overlays.has(overlays, folder ++ "/" ++ name, False{})
339
+ case Fail{why}:
340
+ False{}
341
+
342
+ # The entries of `missing`, files not on disk, that no overlay gives a text either, onto `out` (last first).
343
+ def Overlays.unseen(
344
+ +overlays: List<&2, String>,
345
+ missing: List<&2, String>,
346
+ +out: List<&2, String>
347
+ ) -> IO(List<&2, String>):
348
+ match missing:
349
+ case Nil{}:
350
+ IO.pure(List<&2, String>, List.reverse(&2, String, out))
351
+ case Con{+entry, rest}:
352
+ +name = Shared.Strings.after_last(entry, '/')
353
+ IO.bind(
354
+ Result<&1, &1, U32 & String, String>,
355
+ List<&2, String>,
356
+ Files.real(
357
+ Shared.Strings.take(
358
+ entry,
359
+ Nat.sub(String.length(entry), Nat.add(String.length(name), 1n))
360
+ )
361
+ ),
362
+ real => Overlays.unseen(
363
+ overlays,
364
+ rest,
365
+ Bool.pick(List<&2, String>, Overlays.covers(overlays, real, name), out, entry <> out)
366
+ )
367
+ )
368
+
369
+ # The config at `path`, if each of its entries is a file or has an overlay (`missing` lists those that are neither);
370
+ # else the run ends.
304
371
  def Config.entered(
305
372
  json: Bool,
306
373
  missing: List<&2, String>,
@@ -326,12 +393,11 @@ def Config.parsed(
326
393
  ) -> IO(Project):
327
394
  match parsed:
328
395
  case Done{Project{+entries, imports, rules}}:
329
- IO.bind(
330
- List<&2, String>,
331
- Project,
332
- Files.missing(entries, []),
333
- missing => Config.entered(json, missing, path, Project{entries, imports, rules})
334
- )
396
+ do IO<Project>:
397
+ missing: List<&2, String> <- Files.missing(entries, [])
398
+ given: Result<&1, &1, U32 & String, String> <- IO.get_env("BEND_LINT_OVERLAYS")
399
+ unseen: List<&2, String> <- Overlays.unseen(Overlays.of(given), missing, [])
400
+ Config.entered(json, unseen, path, Project{entries, imports, rules})
335
401
  case Fail{why}:
336
402
  Error.end(Project, json, 2, path, "bend-lint: " ++ path ++ ": " ++ why)
337
403
 
@@ -921,11 +987,11 @@ def Question.fields(questions: List<&2, Lint.Question>, out: List<&2, String>) -
921
987
  def Answer.read(record: List<&2, String>) -> Maybe<&2, Lint.Answer>:
922
988
  match record:
923
989
  case Con{SCon{'s', SCon{'h', rest}}, Con{text, Nil{}}}:
924
- Some{Lint.Shown{text}}
990
+ Some{Lint.Answer.shown(text)}
925
991
  case Con{SCon{'s', SCon{'a', rest}}, Con{same, Nil{}}}:
926
- Some{Lint.Equal{String.eq(same, "true")}}
992
+ Some{Lint.Answer.equal(String.eq(same, "true"))}
927
993
  case Con{SCon{'n', rest}, Con{check, Con{handle, Nil{}}}}:
928
- Maybe.map(&2, U32, Lint.Answer, h => Lint.Normalized{h}, U32.read(handle))
994
+ Maybe.map(&2, U32, Lint.Answer, h => Lint.Answer.normalized(h), U32.read(handle))
929
995
  case _:
930
996
  None{}
931
997
 
@@ -1054,7 +1120,7 @@ def Setting.severity(setting: Maybe<&2, Setting>) -> Maybe<&2, Lint.Severity>:
1054
1120
  None{}
1055
1121
 
1056
1122
  # A rule's option values, once settled: each declared one, given or its default.
1057
- def Setting.options(setting: Maybe<&2, Setting>) -> List<&2, Names.Named<Lint.Value>>:
1123
+ def Setting.options(setting: Maybe<&2, Setting>) -> List<&2, Shared.Names.Named<Lint.Value>>:
1058
1124
  match setting:
1059
1125
  case Some{RuleOn{severity, options}}:
1060
1126
  options
@@ -1063,7 +1129,7 @@ def Setting.options(setting: Maybe<&2, Setting>) -> List<&2, Names.Named<Lint.Va
1063
1129
 
1064
1130
  def About.on(
1065
1131
  abouts: List<&2, About>,
1066
- +settings: List<&2, Names.Named<Setting>>,
1132
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1067
1133
  out: List<&2, About>
1068
1134
  ) -> List<&2, About>:
1069
1135
  match abouts:
@@ -1073,11 +1139,11 @@ def About.on(
1073
1139
  About.on(
1074
1140
  rest,
1075
1141
  settings,
1076
- Lists.push(
1142
+ Shared.Lists.push(
1077
1143
  About,
1078
- Lists.when(
1144
+ Shared.Lists.when(
1079
1145
  About,
1080
- Setting.is_on(Names.lookup(Setting, id, settings)),
1146
+ Setting.is_on(Shared.Names.lookup(Setting, id, settings)),
1081
1147
  About{id, needs, options, every}
1082
1148
  ),
1083
1149
  out
@@ -1093,7 +1159,7 @@ def Rule.keep.if(on: Bool, rule: Rule, out: List<&1, Rule>) -> List<&1, Rule>:
1093
1159
 
1094
1160
  def Rule.on(
1095
1161
  rules: List<&1, Rule>,
1096
- +settings: List<&2, Names.Named<Setting>>,
1162
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1097
1163
  out: List<&1, Rule>
1098
1164
  ) -> List<&1, Rule>:
1099
1165
  match rules:
@@ -1103,7 +1169,7 @@ def Rule.on(
1103
1169
  Rule.on(
1104
1170
  rest,
1105
1171
  settings,
1106
- Rule.keep.if(Setting.is_on(Names.lookup(Setting, id, settings)), Rule{id, rule}, out)
1172
+ Rule.keep.if(Setting.is_on(Shared.Names.lookup(Setting, id, settings)), Rule{id, rule}, out)
1107
1173
  )
1108
1174
 
1109
1175
  def About.ids(abouts: List<&2, About>, out: List<&2, String>) -> List<&2, String>:
@@ -1117,16 +1183,16 @@ def About.ids(abouts: List<&2, About>, out: List<&2, String>) -> List<&2, String
1117
1183
  def About.unchecked(
1118
1184
  broken: Bool,
1119
1185
  abouts: List<&2, About>,
1120
- settings: List<&2, Names.Named<Setting>>
1121
- ) -> List<&2, Names.Named<Setting>>:
1186
+ settings: List<&2, Shared.Names.Named<Setting>>
1187
+ ) -> List<&2, Shared.Names.Named<Setting>>:
1122
1188
  match broken abouts:
1123
1189
  case True{} Con{About{id, Lint.Needs{facts, declarations}, options, every}, rest}:
1124
1190
  About.unchecked(
1125
1191
  True{},
1126
1192
  rest,
1127
- Lists.push(
1128
- Names.Named<Setting>,
1129
- Lists.when(Names.Named<Setting>, facts, Names.Named{id, RuleOff{}}),
1193
+ Shared.Lists.push(
1194
+ Shared.Names.Named<Setting>,
1195
+ Shared.Lists.when(Shared.Names.Named<Setting>, facts, Shared.Names.Named{id, RuleOff{}}),
1130
1196
  settings
1131
1197
  )
1132
1198
  )
@@ -1135,13 +1201,13 @@ def About.unchecked(
1135
1201
 
1136
1202
  def About.modes(
1137
1203
  abouts: List<&2, About>,
1138
- out: List<&2, Names.Named<Bool>>
1139
- ) -> List<&2, Names.Named<Bool>>:
1204
+ out: List<&2, Shared.Names.Named<Bool>>
1205
+ ) -> List<&2, Shared.Names.Named<Bool>>:
1140
1206
  match abouts:
1141
1207
  case Nil{}:
1142
1208
  out
1143
1209
  case Con{About{id, needs, options, every}, rest}:
1144
- About.modes(rest, Names.Named{id, Maybe.default(&2, Bool, every, False{})} <> out)
1210
+ About.modes(rest, Shared.Names.Named{id, Maybe.default(&2, Bool, every, False{})} <> out)
1145
1211
 
1146
1212
  # Options
1147
1213
  # =======
@@ -1168,7 +1234,7 @@ def Spec.fits(fuel: Nat, specs: List<&2, Lint.Spec>, hit: Bool, +value: Lint.Val
1168
1234
  case _ Nil{} False{}:
1169
1235
  False{}
1170
1236
  case 1n+f Con{Lint.AnyOption{inner}, rest} False{}:
1171
- Spec.fits(f, Lists.append(&2, Lint.Spec, inner, rest), False{}, value)
1237
+ Spec.fits(f, Shared.Lists.append(&2, Lint.Spec, inner, rest), False{}, value)
1172
1238
  case 1n+f Con{spec, rest} False{}:
1173
1239
  Spec.fits(f, rest, Spec.accepts(spec, value), value)
1174
1240
 
@@ -1183,14 +1249,14 @@ def Declared.spec(
1183
1249
  case Nil{} None{}:
1184
1250
  None{}
1185
1251
  case Con{Lint.Declared{n, default, spec}, rest} None{}:
1186
- Declared.spec(rest, Lists.when(Lint.Spec, String.eq(n, name), spec), name)
1252
+ Declared.spec(rest, Shared.Lists.when(Lint.Spec, String.eq(n, name), spec), name)
1187
1253
 
1188
1254
  def Option.problem(spec: Maybe<&2, Lint.Spec>, key: String, value: Lint.Value) -> Maybe<&2, String>:
1189
1255
  match spec:
1190
1256
  case None{}:
1191
1257
  Some{"it has no option " ++ key}
1192
1258
  case Some{s}:
1193
- Lists.when(
1259
+ Shared.Lists.when(
1194
1260
  String,
1195
1261
  Bool.not(Spec.fits(8n, [s], False{}, value)),
1196
1262
  key ++ " does not take that value"
@@ -1198,13 +1264,13 @@ def Option.problem(spec: Maybe<&2, Lint.Spec>, key: String, value: Lint.Value) -
1198
1264
 
1199
1265
  # The first problem with the given option values: a name not declared, or a value its spec does not accept.
1200
1266
  def Option.given(
1201
- given: List<&2, Names.Named<Lint.Value>>,
1267
+ given: List<&2, Shared.Names.Named<Lint.Value>>,
1202
1268
  +declared: List<&2, Lint.Declared>
1203
1269
  ) -> Maybe<&2, String>:
1204
1270
  match given:
1205
1271
  case Nil{}:
1206
1272
  None{}
1207
- case Con{Names.Named{+key, value}, rest}:
1273
+ case Con{Shared.Names.Named{+key, value}, rest}:
1208
1274
  Maybe.or(
1209
1275
  &2,
1210
1276
  String,
@@ -1221,7 +1287,7 @@ def Option.defaults(declared: List<&2, Lint.Declared>) -> Maybe<&2, String>:
1221
1287
  Maybe.or(
1222
1288
  &2,
1223
1289
  String,
1224
- Lists.when(
1290
+ Shared.Lists.when(
1225
1291
  String,
1226
1292
  Bool.not(Spec.fits(8n, [spec], False{}, default)),
1227
1293
  "the default of " ++ name ++ " is not a value it takes"
@@ -1231,25 +1297,28 @@ def Option.defaults(declared: List<&2, Lint.Declared>) -> Maybe<&2, String>:
1231
1297
 
1232
1298
  def Option.values(
1233
1299
  declared: List<&2, Lint.Declared>,
1234
- +given: List<&2, Names.Named<Lint.Value>>,
1235
- out: List<&2, Names.Named<Lint.Value>>
1236
- ) -> List<&2, Names.Named<Lint.Value>>:
1300
+ +given: List<&2, Shared.Names.Named<Lint.Value>>,
1301
+ out: List<&2, Shared.Names.Named<Lint.Value>>
1302
+ ) -> List<&2, Shared.Names.Named<Lint.Value>>:
1237
1303
  match declared:
1238
1304
  case Nil{}:
1239
- List.reverse(&2, Names.Named<Lint.Value>, out)
1305
+ List.reverse(&2, Shared.Names.Named<Lint.Value>, out)
1240
1306
  case Con{Lint.Declared{+name, default, spec}, rest}:
1241
1307
  Option.values(
1242
1308
  rest,
1243
1309
  given,
1244
- Names.Named{
1310
+ Shared.Names.Named{
1245
1311
  name,
1246
- Maybe.default(&2, Lint.Value, Names.lookup(Lint.Value, name, given), default)
1312
+ Maybe.default(&2, Lint.Value, Shared.Names.lookup(Lint.Value, name, given), default)
1247
1313
  }
1248
1314
  <> out
1249
1315
  )
1250
1316
 
1251
1317
  # The first problem with a rule's options: a default its own spec does not accept, or what the config gives.
1252
- def About.problem.of(about: About, settings: List<&2, Names.Named<Setting>>) -> Maybe<&2, String>:
1318
+ def About.problem.of(
1319
+ about: About,
1320
+ settings: List<&2, Shared.Names.Named<Setting>>
1321
+ ) -> Maybe<&2, String>:
1253
1322
  match about:
1254
1323
  case About{+id, needs, +options, every}:
1255
1324
  Maybe.map(
@@ -1261,13 +1330,13 @@ def About.problem.of(about: About, settings: List<&2, Names.Named<Setting>>) ->
1261
1330
  &2,
1262
1331
  String,
1263
1332
  Option.defaults(options),
1264
- Option.given(Setting.options(Names.lookup(Setting, id, settings)), options)
1333
+ Option.given(Setting.options(Shared.Names.lookup(Setting, id, settings)), options)
1265
1334
  )
1266
1335
  )
1267
1336
 
1268
1337
  def About.problem(
1269
1338
  abouts: List<&2, About>,
1270
- +settings: List<&2, Names.Named<Setting>>
1339
+ +settings: List<&2, Shared.Names.Named<Setting>>
1271
1340
  ) -> Maybe<&2, String>:
1272
1341
  match abouts:
1273
1342
  case Nil{}:
@@ -1275,31 +1344,31 @@ def About.problem(
1275
1344
  case Con{a, rest}:
1276
1345
  Maybe.or(&2, String, About.problem.of(a, settings), About.problem(rest, settings))
1277
1346
 
1278
- def About.settle.of(about: About, setting: Maybe<&2, Setting>) -> Names.Named<Setting>:
1347
+ def About.settle.of(about: About, setting: Maybe<&2, Setting>) -> Shared.Names.Named<Setting>:
1279
1348
  match about setting:
1280
1349
  case About{id, needs, options, every} Some{RuleOff{}}:
1281
- Names.Named{id, RuleOff{}}
1350
+ Shared.Names.Named{id, RuleOff{}}
1282
1351
  case About{id, needs, options, every} Some{RuleOn{severity, given}}:
1283
- Names.Named{id, RuleOn{severity, Option.values(options, given, [])}}
1352
+ Shared.Names.Named{id, RuleOn{severity, Option.values(options, given, [])}}
1284
1353
  case About{id, needs, options, every} None{}:
1285
- Names.Named{id, RuleOff{}}
1354
+ Shared.Names.Named{id, RuleOff{}}
1286
1355
 
1287
1356
  # Each rule's setting, its option values settled: off, or on with its severity, if any, and every option it declares.
1288
1357
  def About.settle(
1289
1358
  abouts: List<&2, About>,
1290
- +settings: List<&2, Names.Named<Setting>>,
1291
- out: List<&2, Names.Named<Setting>>
1292
- ) -> List<&2, Names.Named<Setting>>:
1359
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1360
+ out: List<&2, Shared.Names.Named<Setting>>
1361
+ ) -> List<&2, Shared.Names.Named<Setting>>:
1293
1362
  match abouts:
1294
1363
  case Nil{}:
1295
- List.reverse(&2, Names.Named<Setting>, out)
1364
+ List.reverse(&2, Shared.Names.Named<Setting>, out)
1296
1365
  case Con{About{+id, needs, options, every}, rest}:
1297
1366
  About.settle(
1298
1367
  rest,
1299
1368
  settings,
1300
1369
  About.settle.of(
1301
1370
  About{id, needs, options, every},
1302
- Names.lookup(Setting, id, settings)
1371
+ Shared.Names.lookup(Setting, id, settings)
1303
1372
  )
1304
1373
  <> out
1305
1374
  )
@@ -1324,19 +1393,19 @@ type Job is Type:
1324
1393
  step: Lint.Step<List<&2, Lint.Finding>>
1325
1394
  }
1326
1395
 
1327
- def Here.with(here: Lint.Here, options: List<&2, Names.Named<Lint.Value>>) -> Lint.Here:
1396
+ def Here.with(here: Lint.Here, options: List<&2, Shared.Names.Named<Lint.Value>>) -> Lint.Here:
1328
1397
  match here:
1329
1398
  case Lint.Here{program, source, declarations, none}:
1330
1399
  Lint.Here{program, source, declarations, options}
1331
1400
 
1332
- def Whole.with(whole: Lint.Whole, options: List<&2, Names.Named<Lint.Value>>) -> Lint.Whole:
1401
+ def Whole.with(whole: Lint.Whole, options: List<&2, Shared.Names.Named<Lint.Value>>) -> Lint.Whole:
1333
1402
  match whole:
1334
1403
  case Lint.Whole{program, declarations, none}:
1335
1404
  Lint.Whole{program, declarations, options}
1336
1405
 
1337
1406
  def Job.start(
1338
1407
  +id: String,
1339
- settings: List<&2, Names.Named<Setting>>,
1408
+ settings: List<&2, Shared.Names.Named<Setting>>,
1340
1409
  path: String,
1341
1410
  group: U32,
1342
1411
  run: Lint.Ask(List<&2, Lint.Finding>)
@@ -1344,7 +1413,7 @@ def Job.start(
1344
1413
  [
1345
1414
  Job{
1346
1415
  id,
1347
- Setting.severity(Names.lookup(Setting, id, settings)),
1416
+ Setting.severity(Shared.Names.lookup(Setting, id, settings)),
1348
1417
  path,
1349
1418
  group,
1350
1419
  run(List<&2, Lint.Finding>, xs => Lint.Finished{xs})
@@ -1352,7 +1421,11 @@ def Job.start(
1352
1421
  ]
1353
1422
 
1354
1423
  # A rule's job at `place`: none where it does not run.
1355
- def Rule.at(rule: Rule, +settings: List<&2, Names.Named<Setting>>, +place: Place) -> List<&1, Job>:
1424
+ def Rule.at(
1425
+ rule: Rule,
1426
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1427
+ +place: Place
1428
+ ) -> List<&1, Job>:
1356
1429
  match rule place:
1357
1430
  case Rule{+id, Lint.Rule{needs, declared, Lint.OnFile{run}}} AtFile{+here}:
1358
1431
  Job.start(
@@ -1360,7 +1433,7 @@ def Rule.at(rule: Rule, +settings: List<&2, Names.Named<Setting>>, +place: Place
1360
1433
  settings,
1361
1434
  Lint.Here.path(here),
1362
1435
  0,
1363
- run(Here.with(here, Setting.options(Names.lookup(Setting, id, settings))))
1436
+ run(Here.with(here, Setting.options(Shared.Names.lookup(Setting, id, settings))))
1364
1437
  )
1365
1438
  case Rule{
1366
1439
  +id,
@@ -1371,14 +1444,14 @@ def Rule.at(rule: Rule, +settings: List<&2, Names.Named<Setting>>, +place: Place
1371
1444
  settings,
1372
1445
  path,
1373
1446
  check,
1374
- run(Whole.with(whole, Setting.options(Names.lookup(Setting, id, settings))))
1447
+ run(Whole.with(whole, Setting.options(Shared.Names.lookup(Setting, id, settings))))
1375
1448
  )
1376
1449
  case _ _:
1377
1450
  []
1378
1451
 
1379
1452
  def Rule.each(
1380
1453
  rules: List<&1, Rule>,
1381
- +settings: List<&2, Names.Named<Setting>>,
1454
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1382
1455
  +place: Place,
1383
1456
  out: List<&1, Job>
1384
1457
  ) -> List<&1, Job>:
@@ -1386,39 +1459,44 @@ def Rule.each(
1386
1459
  case Nil{}:
1387
1460
  List.reverse(&1, Job, out)
1388
1461
  case Con{r, rest}:
1389
- Rule.each(rest, settings, place, Lists.onto(&1, Job, Rule.at(r, settings, place), out))
1462
+ Rule.each(rest, settings, place, Shared.Lists.onto(&1, Job, Rule.at(r, settings, place), out))
1390
1463
 
1391
1464
  # The jobs of the rules of both halves at `place`, in the rules' order: the halves in parallel, dealt again until
1392
1465
  # `depth` runs out.
1393
1466
  def Rule.all(
1394
1467
  +depth: Nat,
1395
1468
  halves: List<&1, Rule> & List<&1, Rule>,
1396
- +settings: List<&2, Names.Named<Setting>>,
1469
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1397
1470
  +place: Place
1398
1471
  ) -> List<&1, Job>:
1399
1472
  match depth halves:
1400
1473
  case 0n Tuple{a, b}:
1401
- Lists.append(&1, Job, Rule.each(a, settings, place, []), Rule.each(b, settings, place, []))
1474
+ Shared.Lists.append(
1475
+ &1,
1476
+ Job,
1477
+ Rule.each(a, settings, place, []),
1478
+ Rule.each(b, settings, place, [])
1479
+ )
1402
1480
  case 1n+d Tuple{a, b}:
1403
1481
  x y = Rule.all(
1404
1482
  d,
1405
- Lists.deal(&1, Rule, a),
1483
+ Shared.Lists.deal(&1, Rule, a),
1406
1484
  settings,
1407
1485
  place
1408
- ) Rule.all(d, Lists.deal(&1, Rule, b), settings, place)
1409
- Lists.append(&1, Job, x, y)
1486
+ ) Rule.all(d, Shared.Lists.deal(&1, Rule, b), settings, place)
1487
+ Shared.Lists.append(&1, Job, x, y)
1410
1488
 
1411
1489
  def Rule.jobs(
1412
1490
  ~rules: List<&1, Rule>,
1413
- +settings: List<&2, Names.Named<Setting>>,
1491
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1414
1492
  place: Place
1415
1493
  ) -> List<&1, Job>:
1416
- Rule.all(3n, Lists.deal(&1, Rule, Rule.on(rules, settings, [])), settings, place)
1494
+ Rule.all(3n, Shared.Lists.deal(&1, Rule, Rule.on(rules, settings, [])), settings, place)
1417
1495
 
1418
1496
  def File.each(
1419
1497
  ~rules: List<&1, Rule>,
1420
1498
  files: List<&2, Lint.Source>,
1421
- +settings: List<&2, Names.Named<Setting>>,
1499
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1422
1500
  +program: Lint.Program,
1423
1501
  +declare: Bool,
1424
1502
  out: List<&1, Job>
@@ -1433,7 +1511,7 @@ def File.each(
1433
1511
  settings,
1434
1512
  program,
1435
1513
  declare,
1436
- Lists.onto(
1514
+ Shared.Lists.onto(
1437
1515
  &1,
1438
1516
  Job,
1439
1517
  Rule.jobs(~rules, settings, AtFile{Lint.Here.of(program, f, declare)}),
@@ -1447,13 +1525,13 @@ def File.all(
1447
1525
  ~rules: List<&1, Rule>,
1448
1526
  +depth: Nat,
1449
1527
  halves: List<&2, Lint.Source> & List<&2, Lint.Source>,
1450
- +settings: List<&2, Names.Named<Setting>>,
1528
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1451
1529
  +program: Lint.Program,
1452
1530
  +declare: Bool
1453
1531
  ) -> List<&1, Job>:
1454
1532
  match depth halves:
1455
1533
  case 0n Tuple{a, b}:
1456
- Lists.append(
1534
+ Shared.Lists.append(
1457
1535
  &1,
1458
1536
  Job,
1459
1537
  File.each(~rules, a, settings, program, declare, []),
@@ -1463,19 +1541,19 @@ def File.all(
1463
1541
  x y = File.all(
1464
1542
  ~rules,
1465
1543
  d,
1466
- Lists.deal(&2, Lint.Source, a),
1544
+ Shared.Lists.deal(&2, Lint.Source, a),
1467
1545
  settings,
1468
1546
  program,
1469
1547
  declare
1470
- ) File.all(~rules, d, Lists.deal(&2, Lint.Source, b), settings, program, declare)
1471
- Lists.append(&1, Job, x, y)
1548
+ ) File.all(~rules, d, Shared.Lists.deal(&2, Lint.Source, b), settings, program, declare)
1549
+ Shared.Lists.append(&1, Job, x, y)
1472
1550
 
1473
1551
  # The jobs of the program rules on the whole program of each check, numbered from `check`; `declare` says whether a
1474
1552
  # rule needs declarations.
1475
1553
  def Check.jobs(
1476
1554
  ~rules: List<&1, Rule>,
1477
1555
  programs: List<&2, Lint.Program>,
1478
- +settings: List<&2, Names.Named<Setting>>,
1556
+ +settings: List<&2, Shared.Names.Named<Setting>>,
1479
1557
  +path: String,
1480
1558
  +declare: Bool,
1481
1559
  +check: U32,
@@ -1492,7 +1570,7 @@ def Check.jobs(
1492
1570
  path,
1493
1571
  declare,
1494
1572
  (check + 1: U32),
1495
- Lists.onto(
1573
+ Shared.Lists.onto(
1496
1574
  &1,
1497
1575
  Job,
1498
1576
  Rule.jobs(~rules, settings, AtProgram{Lint.Whole.of(p, declare), path, check}),
@@ -1505,7 +1583,7 @@ def Check.jobs.if(
1505
1583
  ~rules: List<&1, Rule>,
1506
1584
  whole: Bool,
1507
1585
  programs: List<&2, Lint.Program>,
1508
- settings: List<&2, Names.Named<Setting>>,
1586
+ settings: List<&2, Shared.Names.Named<Setting>>,
1509
1587
  path: String,
1510
1588
  declare: Bool
1511
1589
  ) -> List<&1, Job>:
@@ -1555,8 +1633,8 @@ def Round.hold(
1555
1633
  case Con{Job{r, s, p, g, Lint.Pending{+qs, k}}, rest}:
1556
1634
  Round.hold(
1557
1635
  rest,
1558
- Held{r, s, p, g, Lists.length(&2, Lint.Question, qs), k} <> held,
1559
- Lists.onto(&2, Lint.Question, qs, questions)
1636
+ Held{r, s, p, g, Shared.Lists.length(&2, Lint.Question, qs), k} <> held,
1637
+ Shared.Lists.onto(&2, Lint.Question, qs, questions)
1560
1638
  )
1561
1639
 
1562
1640
  # The held jobs, each given its answers (the next of `answers`, as many as it waits for), as jobs again.
@@ -1671,7 +1749,7 @@ def Found.keys(founds: List<&2, Lint.Found>, keys: Set()) -> Set():
1671
1749
  Found.keys(rest, Set.add(keys, Found.key(f)))
1672
1750
 
1673
1751
  def Found.is_among(keys: Set(), found: Lint.Found) -> Bool:
1674
- Sets.has(keys, Found.key(found))
1752
+ Shared.Sets.has(keys, Found.key(found))
1675
1753
 
1676
1754
  def Found.keep(hit: Bool, found: Lint.Found, out: List<&2, Lint.Found>) -> List<&2, Lint.Found>:
1677
1755
  match hit:
@@ -1708,7 +1786,7 @@ def Merge.new(
1708
1786
  )
1709
1787
 
1710
1788
  def Merge.union(+founds: List<&2, Lint.Found>, more: List<&2, Lint.Found>) -> List<&2, Lint.Found>:
1711
- Lists.append(&2, Lint.Found, founds, Merge.new(more, Found.keys(founds, Set.new()), []))
1789
+ Shared.Lists.append(&2, Lint.Found, founds, Merge.new(more, Found.keys(founds, Set.new()), []))
1712
1790
 
1713
1791
  def Merge.common(
1714
1792
  founds: List<&2, Lint.Found>,
@@ -1760,7 +1838,7 @@ def Merge.stays(every: Maybe<&2, Bool>, partial: Bool, all: Bool) -> Bool:
1760
1838
  def Merge.pick(
1761
1839
  some: List<&2, Lint.Found>,
1762
1840
  +every: Set(),
1763
- +modes: List<&2, Names.Named<Bool>>,
1841
+ +modes: List<&2, Shared.Names.Named<Bool>>,
1764
1842
  +partial: Bool,
1765
1843
  out: List<&2, Lint.Found>
1766
1844
  ) -> List<&2, Lint.Found>:
@@ -1775,7 +1853,7 @@ def Merge.pick(
1775
1853
  partial,
1776
1854
  Found.keep(
1777
1855
  Merge.stays(
1778
- Names.lookup(Bool, r, modes),
1856
+ Shared.Names.lookup(Bool, r, modes),
1779
1857
  partial,
1780
1858
  Found.is_among(every, Lint.Found{r, f})
1781
1859
  ),
@@ -1786,7 +1864,7 @@ def Merge.pick(
1786
1864
 
1787
1865
  def Merge.done(
1788
1866
  merged: List<&2, Lint.Found> & List<&2, Lint.Found>,
1789
- modes: List<&2, Names.Named<Bool>>,
1867
+ modes: List<&2, Shared.Names.Named<Bool>>,
1790
1868
  partial: Bool
1791
1869
  ) -> List<&2, Lint.Found>:
1792
1870
  match merged:
@@ -1797,7 +1875,7 @@ def Merge.done(
1797
1875
  def Merge.program(
1798
1876
  +tagged: List<&2, Tagged>,
1799
1877
  checks: Nat,
1800
- modes: List<&2, Names.Named<Bool>>,
1878
+ modes: List<&2, Shared.Names.Named<Bool>>,
1801
1879
  partial: Bool
1802
1880
  ) -> List<&2, Lint.Found>:
1803
1881
  Merge.done(Merge.checks(checks, tagged, 1, [], Tagged.of(tagged, 1, [])), modes, partial)
@@ -1852,13 +1930,16 @@ def Found.fixes(founds: List<&2, Lint.Found>, out: List<&2, Lint.Fix>) -> List<&
1852
1930
  case Nil{}:
1853
1931
  List.reverse(&2, Lint.Fix, out)
1854
1932
  case Con{Lint.Found{rule, Lint.Finding{severity, span, message, fixes}}, rest}:
1855
- Found.fixes(rest, Lists.onto(&2, Lint.Fix, fixes, out))
1933
+ Found.fixes(rest, Shared.Lists.onto(&2, Lint.Fix, fixes, out))
1856
1934
 
1857
1935
  # A linted file's findings, after its directives, added to the report.
1858
1936
  def Report.add(found: Directives.Suppressed, report: Report) -> Report:
1859
1937
  match found report:
1860
1938
  case Directives.Suppressed{kept, suppressed} Report{k, s}:
1861
- Report{Lists.onto(&2, Lint.Found, kept, k), Lists.onto(&2, Lint.Found, suppressed, s)}
1939
+ Report{
1940
+ Shared.Lists.onto(&2, Lint.Found, kept, k),
1941
+ Shared.Lists.onto(&2, Lint.Found, suppressed, s)
1942
+ }
1862
1943
 
1863
1944
  # Each linted file's findings, after `out`: those of the file rules, then those of the program rules, after its
1864
1945
  # directives.
@@ -1880,8 +1961,13 @@ def report(
1880
1961
  ran,
1881
1962
  Report.add(
1882
1963
  Directives.apply(
1883
- Directives.Linted{path, text, known, ran},
1884
- Lists.append(&2, Lint.Found, Found.in(files, path, []), Found.in(program, path, []))
1964
+ Directives.Linted.of(path, text, known, ran),
1965
+ Shared.Lists.append(
1966
+ &2,
1967
+ Lint.Found,
1968
+ Found.in(files, path, []),
1969
+ Found.in(program, path, [])
1970
+ )
1885
1971
  ),
1886
1972
  out
1887
1973
  )
@@ -1902,7 +1988,7 @@ def Resolved.of(
1902
1988
  case Nil{}:
1903
1989
  List.reverse(&2, Resolved, out)
1904
1990
  case Con{Lint.Found{rule, Lint.Finding{severity, span, message, +fixes}}, rest}:
1905
- +n = Lists.length(&2, Lint.Fix, fixes)
1991
+ +n = Shared.Lists.length(&2, Lint.Fix, fixes)
1906
1992
  Resolved.of(
1907
1993
  rest,
1908
1994
  List.drop(&2, Maybe<&2, List<&2, Text.Edit>>, edits, n),
@@ -1918,7 +2004,7 @@ def Edit.places(edits: List<&2, Text.Edit>, out: List<&2, Text.Place>) -> List<&
1918
2004
  case Nil{}:
1919
2005
  out
1920
2006
  case Con{Text.Edit{+path, beg, end, text}, rest}:
1921
- Edit.places(rest, Text.Place{path, end} <> Text.Place{path, beg} <> out)
2007
+ Edit.places(rest, Text.Place.of(path, end) <> Text.Place.of(path, beg) <> out)
1922
2008
 
1923
2009
  def Fix.places(
1924
2010
  edits: List<&2, Maybe<&2, List<&2, Text.Edit>>>,
@@ -1944,7 +2030,7 @@ def Shown.more(
1944
2030
  case False{}:
1945
2031
  out
1946
2032
  case True{}:
1947
- Fix.places(edits, Text.Place{path, end} <> out)
2033
+ Fix.places(edits, Text.Place.of(path, end) <> out)
1948
2034
 
1949
2035
  def Shown.places(
1950
2036
  +json: Bool,
@@ -1961,7 +2047,7 @@ def Shown.places(
1961
2047
  },
1962
2048
  rest
1963
2049
  }:
1964
- Shown.places(json, rest, Shown.more(json, path, end, edits, Text.Place{path, beg} <> out))
2050
+ Shown.places(json, rest, Shown.more(json, path, end, edits, Text.Place.of(path, beg) <> out))
1965
2051
 
1966
2052
  def Found.line.at(path: String, at: Text.Position, said: String) -> String:
1967
2053
  match at:
@@ -2050,10 +2136,10 @@ def Object.fixes(
2050
2136
  # Where a rule of bend-lint's own, from the package bend-lint-rules, is explained: its file, whose header says what it
2051
2137
  # reports, what its fix does, and its options. Its id is its path in bend-lint's repo.
2052
2138
  def Docs.of(+rule: String) -> Maybe<&2, String>:
2053
- Lists.when(
2139
+ Shared.Lists.when(
2054
2140
  String,
2055
2141
  String.starts_with(rule, "bend-lint-rules/"),
2056
- "https://github.com/MattCozendey/bend-lint/blob/main/" ++ rule ++ ".bend"
2142
+ "https://github.com/MattCozendey/bend-lint/blob/main/src/" ++ rule ++ ".bend"
2057
2143
  )
2058
2144
 
2059
2145
  def Object.finding(resolved: Resolved, +places: Map<&2, Text.Position>) -> Json.Json:
@@ -2067,7 +2153,7 @@ def Object.finding(resolved: Resolved, +places: Map<&2, Text.Position>) -> Json.
2067
2153
  "code",
2068
2154
  Json.JString{rule}
2069
2155
  }
2070
- <> Lists.push(
2156
+ <> Shared.Lists.push(
2071
2157
  Json.JField,
2072
2158
  Maybe.map(
2073
2159
  &2,
@@ -2161,11 +2247,11 @@ def Outcome.add(a: Outcome, b: Outcome) -> Outcome:
2161
2247
  case Outcome{n, f, s, e, x, w} Outcome{m, g, t, d, y, z}:
2162
2248
  Outcome{
2163
2249
  Nat.add(n, m),
2164
- Lists.append(&2, Shown, g, f),
2165
- Lists.append(&2, Shown, t, s),
2250
+ Shared.Lists.append(&2, Shown, g, f),
2251
+ Shared.Lists.append(&2, Shown, t, s),
2166
2252
  e || d,
2167
2253
  (x + y: U32),
2168
- Lists.append(&2, Json.Json, w, z)
2254
+ Shared.Lists.append(&2, Json.Json, w, z)
2169
2255
  }
2170
2256
 
2171
2257
  def summary.fixed(fixing: Bool, fixed: U32) -> String:
@@ -2232,7 +2318,7 @@ def end(json: Bool, total: Outcome, show: Bool, fixing: Bool) -> IO(Unit):
2232
2318
  case False{} Outcome{n, f, +s, False{}, x, w}:
2233
2319
  do IO<Unit>:
2234
2320
  say(suppressed.lines(show, s))
2235
- IO.print(summary(n, Lists.length(&2, Shown, s), summary.fixed(fixing, x)))
2321
+ IO.print(summary(n, Shared.Lists.length(&2, Shown, s), summary.fixed(fixing, x)))
2236
2322
  case True{} Outcome{n, f, +s, +failed, x, w}:
2237
2323
  do IO<Unit>:
2238
2324
  IO.print(
@@ -2247,7 +2333,7 @@ def end(json: Bool, total: Outcome, show: Bool, fixing: Bool) -> IO(Unit):
2247
2333
  }
2248
2334
  )
2249
2335
  )
2250
- end.json(failed, summary(n, Lists.length(&2, Shown, s), summary.fixed(fixing, x)))
2336
+ end.json(failed, summary(n, Shared.Lists.length(&2, Shown, s), summary.fixed(fixing, x)))
2251
2337
 
2252
2338
  # An outcome as a worker gives it: its count, fixes and failure, then its findings and those directives suppressed
2253
2339
  # (first first; a line as a JSON string, an object as itself).
@@ -2340,10 +2426,10 @@ def outcome(report: Report, +json: Bool, +fixing: Bool, program: Lint.Program) -
2340
2426
  match report program:
2341
2427
  case Report{kept, suppressed} Lint.Program{+sources}:
2342
2428
  +founds = List.reverse(&2, Lint.Found, kept)
2343
- +all = Lists.append(&2, Lint.Found, founds, List.reverse(&2, Lint.Found, suppressed))
2429
+ +all = Shared.Lists.append(&2, Lint.Found, founds, List.reverse(&2, Lint.Found, suppressed))
2344
2430
  +declarations = Declarations.of(json || fixing, sources)
2345
2431
  +resolved = Resolved.of(all, Shown.edits(json, all, declarations, sources), [])
2346
- +n = Lists.length(&2, Lint.Found, founds)
2432
+ +n = Shared.Lists.length(&2, Lint.Found, founds)
2347
2433
  +shown = List.reverse(
2348
2434
  &2,
2349
2435
  Shown,
@@ -2361,7 +2447,7 @@ def outcome(report: Report, +json: Bool, +fixing: Bool, program: Lint.Program) -
2361
2447
  n,
2362
2448
  List.reverse(&2, Shown, Shown.kept(json, List.take(&2, Shown, shown, n))),
2363
2449
  List.reverse(&2, Shown, List.drop(&2, Shown, shown, n)),
2364
- Lists.any(~Lint.Found, ~Found.is_error, founds),
2450
+ Shared.Lists.any(~Lint.Found, ~Found.is_error, founds),
2365
2451
  fixed,
2366
2452
  []
2367
2453
  }
@@ -2378,7 +2464,7 @@ def finish(
2378
2464
  linted: List<&2, Lint.Source>,
2379
2465
  +tagged: List<&2, Tagged>,
2380
2466
  checks: Nat,
2381
- modes: List<&2, Names.Named<Bool>>,
2467
+ modes: List<&2, Shared.Names.Named<Bool>>,
2382
2468
  partial: Bool,
2383
2469
  known: List<&2, String>,
2384
2470
  ran: List<&2, String>,
@@ -2417,26 +2503,26 @@ def lint(
2417
2503
  path: String,
2418
2504
  +programs: List<&2, Lint.Program>,
2419
2505
  partial: Bool,
2420
- +settings: List<&2, Names.Named<Setting>>,
2506
+ +settings: List<&2, Shared.Names.Named<Setting>>,
2421
2507
  json: Bool,
2422
2508
  fixing: Bool
2423
2509
  ) -> IO(Outcome):
2424
2510
  +abouts = About.all(rules, [])
2425
2511
  +on = About.on(abouts, settings, [])
2426
- +declare = Lists.any(~About, ~About.needs_declarations, on)
2512
+ +declare = Shared.Lists.any(~About, ~About.needs_declarations, on)
2427
2513
  IO.bind(
2428
2514
  List<&2, Tagged>,
2429
2515
  Outcome,
2430
2516
  Rounds.go(
2431
2517
  budget(),
2432
2518
  Round.hold(
2433
- Lists.append(
2519
+ Shared.Lists.append(
2434
2520
  &1,
2435
2521
  Job,
2436
2522
  File.all(
2437
2523
  ~rules,
2438
2524
  3n,
2439
- Lists.deal(&2, Lint.Source, linted),
2525
+ Shared.Lists.deal(&2, Lint.Source, linted),
2440
2526
  settings,
2441
2527
  Maybe.default(
2442
2528
  &2,
@@ -2448,7 +2534,7 @@ def lint(
2448
2534
  ),
2449
2535
  Check.jobs.if(
2450
2536
  ~rules,
2451
- Lists.any(~About, ~About.is_whole, on),
2537
+ Shared.Lists.any(~About, ~About.is_whole, on),
2452
2538
  programs,
2453
2539
  settings,
2454
2540
  path,
@@ -2462,7 +2548,7 @@ def lint(
2462
2548
  tagged => finish(
2463
2549
  linted,
2464
2550
  tagged,
2465
- Lists.length(&2, Lint.Program, programs),
2551
+ Shared.Lists.length(&2, Lint.Program, programs),
2466
2552
  About.modes(abouts, []),
2467
2553
  partial,
2468
2554
  About.ids(abouts, []),
@@ -2486,7 +2572,7 @@ def Source.at(
2486
2572
  case Con{Lint.Source{+p, namespace, text, nodes}, rest} None{}:
2487
2573
  Source.at(
2488
2574
  rest,
2489
- Lists.when(Lint.Source, String.eq(p, path), Lint.Source{p, namespace, text, nodes}),
2575
+ Shared.Lists.when(Lint.Source, String.eq(p, path), Lint.Source{p, namespace, text, nodes}),
2490
2576
  path
2491
2577
  )
2492
2578
 
@@ -2642,13 +2728,13 @@ def Skipped.said(skips: List<&2, Skipped>, out: List<&2, Json.Json>) -> IO(List<
2642
2728
  def Outcome.skip(outcome: Outcome, skipped: List<&2, Json.Json>) -> Outcome:
2643
2729
  match outcome:
2644
2730
  case Outcome{n, f, s, e, x, w}:
2645
- Outcome{n, f, s, e, x, Lists.append(&2, Json.Json, skipped, w)}
2731
+ Outcome{n, f, s, e, x, Shared.Lists.append(&2, Json.Json, skipped, w)}
2646
2732
 
2647
2733
  def checked(
2648
2734
  ~rules: List<&1, Rule>,
2649
2735
  +path: String,
2650
2736
  imports: Bool,
2651
- +settings: List<&2, Names.Named<Setting>>,
2737
+ +settings: List<&2, Shared.Names.Named<Setting>>,
2652
2738
  json: Bool,
2653
2739
  fixing: Bool,
2654
2740
  checks: Checks
@@ -2656,7 +2742,7 @@ def checked(
2656
2742
  match checks:
2657
2743
  case Checks{Con{Lint.Program{+sources}, rest}, +failing, +failed, forget}:
2658
2744
  +on = About.on(About.all(rules, []), settings, [])
2659
- skips = Lists.append(
2745
+ skips = Shared.Lists.append(
2660
2746
  &2,
2661
2747
  Skipped,
2662
2748
  unchecked(failed, About.ids(List.filter(~About, ~About.needs_facts, on), []), path),
@@ -2861,7 +2947,7 @@ def settled(
2861
2947
  json: Bool,
2862
2948
  fixing: Bool,
2863
2949
  entries: List<&2, String>,
2864
- +settings: List<&2, Names.Named<Setting>>
2950
+ +settings: List<&2, Shared.Names.Named<Setting>>
2865
2951
  ) -> IO(Outcome):
2866
2952
  IO.bind(
2867
2953
  Checks,
@@ -2870,7 +2956,7 @@ def settled(
2870
2956
  imports,
2871
2957
  entries,
2872
2958
  path,
2873
- Lists.any(~About, ~About.needs_facts, About.on(About.all(rules, []), settings, []))
2959
+ Shared.Lists.any(~About, ~About.needs_facts, About.on(About.all(rules, []), settings, []))
2874
2960
  ),
2875
2961
  checks => checked(~rules, path, imports, settings, json, fixing, checks)
2876
2962
  )
@@ -2906,14 +2992,14 @@ type Flag is Data:
2906
2992
  WorkerFlag{}
2907
2993
  JobsFlag{}
2908
2994
 
2909
- def flags() -> List<&2, Names.Named<Flag>>:
2995
+ def flags() -> List<&2, Shared.Names.Named<Flag>>:
2910
2996
  [
2911
- Names.Named{"--fix", FixFlag{Some{False{}}}},
2912
- Names.Named{"--fix-dangerously", FixFlag{Some{True{}}}},
2913
- Names.Named{"--show-suppressed", ShownFlag{}},
2914
- Names.Named{"--json", JsonFlag{}},
2915
- Names.Named{"--worker", WorkerFlag{}},
2916
- Names.Named{"--jobs", JobsFlag{}}
2997
+ Shared.Names.Named{"--fix", FixFlag{Some{False{}}}},
2998
+ Shared.Names.Named{"--fix-dangerously", FixFlag{Some{True{}}}},
2999
+ Shared.Names.Named{"--show-suppressed", ShownFlag{}},
3000
+ Shared.Names.Named{"--json", JsonFlag{}},
3001
+ Shared.Names.Named{"--worker", WorkerFlag{}},
3002
+ Shared.Names.Named{"--jobs", JobsFlag{}}
2917
3003
  ]
2918
3004
 
2919
3005
  def Options.set(flag: Maybe<&2, Flag>, options: Maybe<&2, Options>) -> Maybe<&2, Options>:
@@ -2934,7 +3020,7 @@ def Options.set(flag: Maybe<&2, Flag>, options: Maybe<&2, Options>) -> Maybe<&2,
2934
3020
  def Jobs.number(number: Maybe<&2, U32>) -> Maybe<&2, Jobs>:
2935
3021
  match number:
2936
3022
  case Some{+n}:
2937
- Lists.when(Jobs, U32.is_gt(n, 0), Count{n})
3023
+ Shared.Lists.when(Jobs, U32.is_gt(n, 0), Count{n})
2938
3024
  case None{}:
2939
3025
  None{}
2940
3026
 
@@ -2966,7 +3052,7 @@ def Options.input(input: String, options: Maybe<&2, Options>) -> Maybe<&2, Optio
2966
3052
  def Options.arg(flag: Bool, arg: String, options: Maybe<&2, Options>) -> Maybe<&2, Options>:
2967
3053
  match flag:
2968
3054
  case True{}:
2969
- Options.set(Names.lookup(Flag, arg, flags()), options)
3055
+ Options.set(Shared.Names.lookup(Flag, arg, flags()), options)
2970
3056
  case False{}:
2971
3057
  Options.input(arg, options)
2972
3058
 
@@ -3029,16 +3115,6 @@ def Paths.lint(
3029
3115
  o => Paths.lint(~rules, rest, options, many, Outcome.add(total, o))
3030
3116
  )
3031
3117
 
3032
- # The paths the server holds an overlay for (`--overlays`, see seam.ts), one a line in BEND_LINT_OVERLAYS: none, if it
3033
- # gives none.
3034
- def Overlays.of(given: Result<&1, &1, U32 & String, String>) -> List<&2, String>:
3035
- match given:
3036
- case Done{text}:
3037
- List.filter(~String, ~(n => Bool.not(String.is_empty(n))), String.split(text, '
3038
- '))
3039
- case Fail{why}:
3040
- []
3041
-
3042
3118
  # Stops a run that makes fixes (`fixes`) to files with overlays: a fix writes the file on disk, not the text it linted.
3043
3119
  def Overlays.fixing(json: Bool, fixes: Bool, overlays: List<&2, String>) -> IO(Unit):
3044
3120
  match fixes overlays:
@@ -3060,7 +3136,7 @@ def files.of(
3060
3136
  ) -> IO(List<&2, String>):
3061
3137
  match found:
3062
3138
  case Done{paths}:
3063
- IO.pure(List<&2, String>, Lists.append(&2, String, kept, paths))
3139
+ IO.pure(List<&2, String>, Shared.Lists.append(&2, String, kept, paths))
3064
3140
  case Fail{why}:
3065
3141
  Error.end(List<&2, String>, json, 2, "", "bend-lint: " ++ why)
3066
3142
 
@@ -3080,8 +3156,8 @@ def files.sort(
3080
3156
  files.sort(
3081
3157
  more,
3082
3158
  overlays,
3083
- Lists.push(String, Lists.when(String, hit, input), kept),
3084
- Lists.push(String, Lists.when(String, Bool.not(hit), input), rest)
3159
+ Shared.Lists.push(String, Shared.Lists.when(String, hit, input), kept),
3160
+ Shared.Lists.push(String, Shared.Lists.when(String, Bool.not(hit), input), rest)
3085
3161
  )
3086
3162
 
3087
3163
  # The files of `sorted` (see files.sort): those with an overlay, which need not be on disk, then those the others name.
@@ -3345,7 +3421,7 @@ def Workers.is_wanted(program: String, paths: List<&2, String>, options: Options
3345
3421
  Options.fixes(fixing)
3346
3422
  )
3347
3423
  && Workers.is_native(program)
3348
- && Nat.is_gt(Lists.length(&2, String, paths), 1n)
3424
+ && Nat.is_gt(Shared.Lists.length(&2, String, paths), 1n)
3349
3425
  case _:
3350
3426
  False{}
3351
3427
 
@@ -3353,7 +3429,7 @@ def Workers.is_wanted(program: String, paths: List<&2, String>, options: Options
3353
3429
  def Options.is_many(options: Options, paths: List<&2, String>) -> Bool:
3354
3430
  match options:
3355
3431
  case Options{inputs, fixing, shown, json, worker, jobs}:
3356
- worker || Nat.is_gt(Lists.length(&2, String, paths), 1n)
3432
+ worker || Nat.is_gt(Shared.Lists.length(&2, String, paths), 1n)
3357
3433
 
3358
3434
  def Paths.go(
3359
3435
  ~rules: List<&1, Rule>,