firefly-compiler 0.4.5 → 0.4.6

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.
Files changed (78) hide show
  1. package/.hintrc +4 -4
  2. package/README.md +1 -1
  3. package/core/HttpClient.ff +1 -1
  4. package/lsp/LanguageServer.ff +32 -7
  5. package/lsp/stderr.txt +1 -0
  6. package/lsp/stdin.txt +11 -0
  7. package/lsp/stdout.txt +41 -0
  8. package/lux/Main.ff +56 -2
  9. package/meetup/AutoCompletion.ff +6 -0
  10. package/output/js/ff/compiler/Builder.mjs +444 -444
  11. package/output/js/ff/compiler/Compiler.mjs +416 -416
  12. package/output/js/ff/compiler/Dependencies.mjs +389 -389
  13. package/output/js/ff/compiler/Deriver.mjs +1170 -1170
  14. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1309
  15. package/output/js/ff/compiler/Environment.mjs +1015 -1015
  16. package/output/js/ff/compiler/Inference.mjs +4268 -4268
  17. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5391
  18. package/output/js/ff/compiler/JsImporter.mjs +266 -266
  19. package/output/js/ff/compiler/LspHook.mjs +793 -793
  20. package/output/js/ff/compiler/Main.mjs +1675 -1675
  21. package/output/js/ff/compiler/Parser.mjs +4008 -4008
  22. package/output/js/ff/compiler/Patterns.mjs +927 -927
  23. package/output/js/ff/compiler/Resolver.mjs +2307 -2307
  24. package/output/js/ff/compiler/Substitution.mjs +1150 -1150
  25. package/output/js/ff/compiler/Syntax.mjs +12434 -12434
  26. package/output/js/ff/compiler/Token.mjs +3096 -3096
  27. package/output/js/ff/compiler/Tokenizer.mjs +593 -593
  28. package/output/js/ff/compiler/Unification.mjs +1752 -1752
  29. package/output/js/ff/compiler/Wildcards.mjs +608 -608
  30. package/output/js/ff/compiler/Workspace.mjs +687 -687
  31. package/output/js/ff/core/Any.mjs +143 -143
  32. package/output/js/ff/core/Array.mjs +547 -547
  33. package/output/js/ff/core/AssetSystem.mjs +274 -274
  34. package/output/js/ff/core/Atomic.mjs +154 -154
  35. package/output/js/ff/core/Bool.mjs +152 -152
  36. package/output/js/ff/core/Box.mjs +112 -112
  37. package/output/js/ff/core/BrowserSystem.mjs +126 -126
  38. package/output/js/ff/core/Buffer.mjs +395 -395
  39. package/output/js/ff/core/BuildSystem.mjs +296 -296
  40. package/output/js/ff/core/Channel.mjs +189 -189
  41. package/output/js/ff/core/Char.mjs +149 -149
  42. package/output/js/ff/core/Core.mjs +300 -300
  43. package/output/js/ff/core/Duration.mjs +116 -116
  44. package/output/js/ff/core/Equal.mjs +179 -179
  45. package/output/js/ff/core/Error.mjs +142 -142
  46. package/output/js/ff/core/FileHandle.mjs +150 -150
  47. package/output/js/ff/core/Float.mjs +225 -225
  48. package/output/js/ff/core/HttpClient.mjs +190 -190
  49. package/output/js/ff/core/Instant.mjs +109 -109
  50. package/output/js/ff/core/Int.mjs +265 -265
  51. package/output/js/ff/core/IntMap.mjs +280 -280
  52. package/output/js/ff/core/JsSystem.mjs +238 -238
  53. package/output/js/ff/core/JsValue.mjs +708 -708
  54. package/output/js/ff/core/List.mjs +2334 -2334
  55. package/output/js/ff/core/Lock.mjs +229 -229
  56. package/output/js/ff/core/Log.mjs +163 -163
  57. package/output/js/ff/core/Map.mjs +362 -362
  58. package/output/js/ff/core/NodeSystem.mjs +294 -294
  59. package/output/js/ff/core/Nothing.mjs +104 -104
  60. package/output/js/ff/core/Option.mjs +1015 -1015
  61. package/output/js/ff/core/Ordering.mjs +730 -730
  62. package/output/js/ff/core/Pair.mjs +331 -331
  63. package/output/js/ff/core/Path.mjs +545 -545
  64. package/output/js/ff/core/RbMap.mjs +1940 -1940
  65. package/output/js/ff/core/Serializable.mjs +428 -428
  66. package/output/js/ff/core/Set.mjs +254 -254
  67. package/output/js/ff/core/Show.mjs +205 -205
  68. package/output/js/ff/core/SourceLocation.mjs +229 -229
  69. package/output/js/ff/core/Stack.mjs +529 -529
  70. package/output/js/ff/core/Stream.mjs +1304 -1304
  71. package/output/js/ff/core/String.mjs +365 -365
  72. package/output/js/ff/core/StringMap.mjs +280 -280
  73. package/output/js/ff/core/Task.mjs +320 -320
  74. package/output/js/ff/core/Try.mjs +507 -507
  75. package/output/js/ff/core/Unit.mjs +151 -151
  76. package/package.json +29 -29
  77. package/vscode/package-lock.json +5 -5
  78. package/vscode/package.json +1 -1
@@ -1,1150 +1,1150 @@
1
-
2
-
3
- import * as ff_compiler_Substitution from "../../ff/compiler/Substitution.mjs"
4
-
5
- import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
6
-
7
- import * as ff_core_Any from "../../ff/core/Any.mjs"
8
-
9
- import * as ff_core_Array from "../../ff/core/Array.mjs"
10
-
11
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
12
-
13
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
14
-
15
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
16
-
17
- import * as ff_core_Box from "../../ff/core/Box.mjs"
18
-
19
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
20
-
21
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
22
-
23
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
24
-
25
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
26
-
27
- import * as ff_core_Char from "../../ff/core/Char.mjs"
28
-
29
- import * as ff_core_Core from "../../ff/core/Core.mjs"
30
-
31
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
32
-
33
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
34
-
35
- import * as ff_core_Error from "../../ff/core/Error.mjs"
36
-
37
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
38
-
39
- import * as ff_core_Float from "../../ff/core/Float.mjs"
40
-
41
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
42
-
43
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
44
-
45
- import * as ff_core_Int from "../../ff/core/Int.mjs"
46
-
47
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
48
-
49
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
50
-
51
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
52
-
53
- import * as ff_core_List from "../../ff/core/List.mjs"
54
-
55
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
56
-
57
- import * as ff_core_Log from "../../ff/core/Log.mjs"
58
-
59
- import * as ff_core_Map from "../../ff/core/Map.mjs"
60
-
61
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
62
-
63
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
64
-
65
- import * as ff_core_Option from "../../ff/core/Option.mjs"
66
-
67
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
68
-
69
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
70
-
71
- import * as ff_core_Path from "../../ff/core/Path.mjs"
72
-
73
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
-
75
- import * as ff_core_Set from "../../ff/core/Set.mjs"
76
-
77
- import * as ff_core_Show from "../../ff/core/Show.mjs"
78
-
79
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
-
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
-
85
- import * as ff_core_String from "../../ff/core/String.mjs"
86
-
87
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
88
-
89
- import * as ff_core_Task from "../../ff/core/Task.mjs"
90
-
91
- import * as ff_core_Try from "../../ff/core/Try.mjs"
92
-
93
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
94
-
95
- // type Substitution
96
- export function Substitution(substitution_) {
97
- return {substitution_};
98
- }
99
-
100
-
101
-
102
- export function core_(name_) {
103
- return ((("ff:core/" + name_) + ".") + name_)
104
- }
105
-
106
- export async function core_$(name_, $task) {
107
- return ((("ff:core/" + name_) + ".") + name_)
108
- }
109
-
110
- export function Substitution_substituteModule(self_, module_) {
111
- const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
112
- return ff_compiler_Substitution.Substitution_substituteLetDefinition(self_, _w1)
113
- }));
114
- const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
115
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
116
- }));
117
- const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
118
- return ff_compiler_Substitution.Substitution_substituteExtendDefinition(self_, _w1)
119
- }));
120
- const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
121
- return ff_compiler_Substitution.Substitution_substituteInstanceDefinition(self_, _w1)
122
- }));
123
- {
124
- const _1 = module_;
125
- {
126
- const _c = _1;
127
- return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, _c.traits_, instances_, extends_, lets_, functions_)
128
- return
129
- }
130
- }
131
- }
132
-
133
- export function Substitution_substituteLetDefinition(self_, definition_) {
134
- {
135
- const _1 = definition_;
136
- {
137
- const _c = _1;
138
- return ff_compiler_Syntax.DLet(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.variableType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, definition_.value_))
139
- return
140
- }
141
- }
142
- }
143
-
144
- export function Substitution_substituteExtendDefinition(self_, definition_) {
145
- {
146
- const _1 = definition_;
147
- {
148
- const _c = _1;
149
- return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
150
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
151
- })))
152
- return
153
- }
154
- }
155
- }
156
-
157
- export function Substitution_substituteFunctionDefinition(self_, definition_) {
158
- {
159
- const _1 = definition_;
160
- {
161
- const _c = _1;
162
- return ff_compiler_Syntax.DFunction(_c.at_, ff_compiler_Substitution.Substitution_substituteSignature(self_, definition_.signature_), ff_compiler_Syntax.Target_mapFirefly(definition_.body_, ((_w1) => {
163
- return ff_compiler_Substitution.Substitution_substituteLambda(self_, _w1)
164
- })))
165
- return
166
- }
167
- }
168
- }
169
-
170
- export function Substitution_substituteSignature(self_, signature_) {
171
- {
172
- const _1 = signature_;
173
- {
174
- const _c = _1;
175
- return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, ff_core_List.List_map(signature_.constraints_, ((_w1) => {
176
- return ff_compiler_Substitution.Substitution_substituteConstraint(self_, _w1)
177
- })), ff_core_List.List_map(signature_.parameters_, ((_w1) => {
178
- return ff_compiler_Substitution.Substitution_substituteParameter(self_, _w1)
179
- })), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.returnType_), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.effect_))
180
- return
181
- }
182
- }
183
- }
184
-
185
- export function Substitution_substituteConstraint(self_, constraint_) {
186
- {
187
- const _1 = constraint_;
188
- {
189
- const _c = _1;
190
- return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.List_map(constraint_.generics_, ((_w1) => {
191
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
192
- })))
193
- return
194
- }
195
- }
196
- }
197
-
198
- export function Substitution_substituteParameter(self_, parameter_) {
199
- {
200
- const _1 = parameter_;
201
- {
202
- const _c = _1;
203
- return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, parameter_.valueType_), ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
204
- return ff_compiler_Substitution.Substitution_substituteTerm(self_, _w1)
205
- })))
206
- return
207
- }
208
- }
209
- }
210
-
211
- export function Substitution_substituteInstanceDefinition(self_, definition_) {
212
- {
213
- const _1 = definition_;
214
- {
215
- const _c = _1;
216
- return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
217
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
218
- })), _c.derived_)
219
- return
220
- }
221
- }
222
- }
223
-
224
- export function Substitution_substituteLambda(self_, definition_) {
225
- {
226
- const _1 = definition_;
227
- {
228
- const _c = _1;
229
- return ff_compiler_Syntax.Lambda(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.effect_), ff_core_List.List_map(definition_.cases_, ((case_) => {
230
- {
231
- const _1 = case_;
232
- {
233
- const _c = _1;
234
- return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_List.List_map(case_.guards_, ((g_) => {
235
- {
236
- const _1 = g_;
237
- {
238
- const _c = _1;
239
- return ff_compiler_Syntax.MatchGuard(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, g_.term_), _c.pattern_)
240
- return
241
- }
242
- }
243
- })), ff_compiler_Substitution.Substitution_substituteTerm(self_, case_.body_))
244
- return
245
- }
246
- }
247
- })))
248
- return
249
- }
250
- }
251
- }
252
-
253
- export function Substitution_substituteTerm(self_, term_) {
254
- {
255
- const _1 = term_;
256
- {
257
- if(_1.EString) {
258
- return term_
259
- return
260
- }
261
- }
262
- {
263
- if(_1.EChar) {
264
- return term_
265
- return
266
- }
267
- }
268
- {
269
- if(_1.EInt) {
270
- return term_
271
- return
272
- }
273
- }
274
- {
275
- if(_1.EFloat) {
276
- return term_
277
- return
278
- }
279
- }
280
- {
281
- if(_1.EVariable) {
282
- return term_
283
- return
284
- }
285
- }
286
- {
287
- if(_1.EField) {
288
- const e_ = _1;
289
- {
290
- const _1 = e_;
291
- {
292
- const _c = _1;
293
- return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_)
294
- return
295
- }
296
- }
297
- return
298
- }
299
- }
300
- {
301
- if(_1.EWildcard) {
302
- const e_ = _1;
303
- return term_
304
- return
305
- }
306
- }
307
- {
308
- if(_1.EList) {
309
- const e_ = _1;
310
- {
311
- const _1 = e_;
312
- {
313
- const _c = _1;
314
- return ff_compiler_Syntax.EList(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.elementType_), ff_core_List.List_map(e_.items_, ((_1) => {
315
- {
316
- const item_ = _1.first_;
317
- const b_ = _1.second_;
318
- return ff_core_Pair.Pair(ff_compiler_Substitution.Substitution_substituteTerm(self_, item_), b_)
319
- return
320
- }
321
- })))
322
- return
323
- }
324
- }
325
- return
326
- }
327
- }
328
- {
329
- if(_1.ESequential) {
330
- const e_ = _1;
331
- {
332
- const _1 = e_;
333
- {
334
- const _c = _1;
335
- return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.before_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.after_))
336
- return
337
- }
338
- }
339
- return
340
- }
341
- }
342
- {
343
- if(_1.ELet) {
344
- const e_ = _1;
345
- {
346
- const _1 = e_;
347
- {
348
- const _c = _1;
349
- return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.valueType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
350
- return
351
- }
352
- }
353
- return
354
- }
355
- }
356
- {
357
- if(_1.ELambda) {
358
- const e_ = _1;
359
- {
360
- const _1 = e_;
361
- {
362
- const _c = _1;
363
- return ff_compiler_Syntax.ELambda(_c.at_, ff_compiler_Substitution.Substitution_substituteLambda(self_, e_.lambda_))
364
- return
365
- }
366
- }
367
- return
368
- }
369
- }
370
- {
371
- if(_1.EVariant) {
372
- const e_ = _1;
373
- {
374
- const _1 = e_;
375
- {
376
- const _c = _1;
377
- return ff_compiler_Syntax.EVariant(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
378
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
379
- })), ff_core_Option.Option_map(e_.arguments_, ((_w1) => {
380
- return ff_core_List.List_map(_w1, ((_w1) => {
381
- return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
382
- }))
383
- })))
384
- return
385
- }
386
- }
387
- return
388
- }
389
- }
390
- {
391
- if(_1.EVariantIs) {
392
- const e_ = _1;
393
- {
394
- const _1 = e_;
395
- {
396
- const _c = _1;
397
- return ff_compiler_Syntax.EVariantIs(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
398
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
399
- })))
400
- return
401
- }
402
- }
403
- return
404
- }
405
- }
406
- {
407
- if(_1.ECopy) {
408
- const e_ = _1;
409
- {
410
- const _1 = e_;
411
- {
412
- const _c = _1;
413
- return ff_compiler_Syntax.ECopy(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), ff_core_List.List_map(e_.arguments_, ((_w1) => {
414
- return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
415
- })))
416
- return
417
- }
418
- }
419
- return
420
- }
421
- }
422
- {
423
- if(_1.EPipe) {
424
- const e_ = _1;
425
- {
426
- const _1 = e_;
427
- {
428
- const _c = _1;
429
- return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.function_))
430
- return
431
- }
432
- }
433
- return
434
- }
435
- }
436
- {
437
- if(_1.ECall) {
438
- const e_ = _1;
439
- {
440
- const _1 = e_;
441
- {
442
- const _c = _1;
443
- return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
444
- {
445
- if(_1.DynamicCall) {
446
- const call_ = _1;
447
- {
448
- const _1 = call_;
449
- {
450
- const _c = _1;
451
- return ff_compiler_Syntax.DynamicCall(ff_compiler_Substitution.Substitution_substituteTerm(self_, call_.function_), _c.tailCall_)
452
- return
453
- }
454
- }
455
- return
456
- }
457
- }
458
- {
459
- if(_1.StaticCall) {
460
- return e_.target_
461
- return
462
- }
463
- }
464
- }))(e_.target_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
465
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
466
- })), ff_core_List.List_map(e_.arguments_, ((_w1) => {
467
- return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
468
- })), _c.dictionaries_)
469
- return
470
- }
471
- }
472
- return
473
- }
474
- }
475
- {
476
- if(_1.ERecord) {
477
- const e_ = _1;
478
- {
479
- const _1 = e_;
480
- {
481
- const _c = _1;
482
- return ff_compiler_Syntax.ERecord(_c.at_, ff_core_List.List_map(e_.fields_, ((_w1) => {
483
- return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
484
- })))
485
- return
486
- }
487
- }
488
- return
489
- }
490
- }
491
- {
492
- if(_1.EFunctions) {
493
- const e_ = _1;
494
- {
495
- const _1 = e_;
496
- {
497
- const _c = _1;
498
- return ff_compiler_Syntax.EFunctions(_c.at_, ff_core_List.List_map(e_.functions_, ((_w1) => {
499
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
500
- })), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
501
- return
502
- }
503
- }
504
- return
505
- }
506
- }
507
- {
508
- if(_1.EAssign) {
509
- const e_ = _1;
510
- {
511
- const _1 = e_;
512
- {
513
- const _c = _1;
514
- return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
515
- return
516
- }
517
- }
518
- return
519
- }
520
- }
521
- {
522
- if(_1.EAssignField) {
523
- const e_ = _1;
524
- {
525
- const _1 = e_;
526
- {
527
- const _c = _1;
528
- return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
529
- return
530
- }
531
- }
532
- return
533
- }
534
- }
535
- }
536
- }
537
-
538
- export function Substitution_substituteArgument(self_, argument_) {
539
- {
540
- const _1 = argument_;
541
- {
542
- const _c = _1;
543
- return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, argument_.value_))
544
- return
545
- }
546
- }
547
- }
548
-
549
- export function Substitution_substituteField(self_, field_) {
550
- {
551
- const _1 = field_;
552
- {
553
- const _c = _1;
554
- return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, field_.value_))
555
- return
556
- }
557
- }
558
- }
559
-
560
- export function Substitution_substituteType(self_, type_) {
561
- {
562
- const self_a = self_;
563
- const type_a = type_;
564
- {
565
- if(type_a.TVariable) {
566
- const at_ = type_a.at_;
567
- const i_ = type_a.index_;
568
- if(ff_compiler_Substitution.Substitution_has(self_, i_)) {
569
- return ff_compiler_Substitution.Substitution_substituteType(self_, ff_compiler_Substitution.Substitution_get(self_, i_))
570
- } else {
571
- return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
572
- }
573
- return
574
- }
575
- }
576
- {
577
- if(type_a.TConstructor) {
578
- const t_ = type_a;
579
- {
580
- const _1 = t_;
581
- {
582
- const _c = _1;
583
- return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
584
- return ff_compiler_Substitution.Substitution_substituteType(self_, t_)
585
- })))
586
- return
587
- }
588
- }
589
- return
590
- }
591
- }
592
- }
593
- }
594
-
595
- export function Substitution_get(self_, index_) {
596
- {
597
- const _1 = ff_core_Map.Map_grab(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
598
- {
599
- if(_1.TVariable) {
600
- const i_ = _1.index_;
601
- const _guard1 = ff_compiler_Substitution.Substitution_has(self_, i_);
602
- if(_guard1) {
603
- const t_ = ff_compiler_Substitution.Substitution_get(self_, i_);
604
- self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
605
- return t_
606
- return
607
- }
608
- }
609
- }
610
- {
611
- if(_1.TVariable) {
612
- const at_ = _1.at_;
613
- return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
614
- return
615
- }
616
- }
617
- {
618
- const t_ = _1;
619
- return t_
620
- return
621
- }
622
- }
623
- }
624
-
625
- export function Substitution_has(self_, index_) {
626
- return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
627
- }
628
-
629
- export async function Substitution_substituteModule$(self_, module_, $task) {
630
- const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
631
- return ff_compiler_Substitution.Substitution_substituteLetDefinition(self_, _w1)
632
- }));
633
- const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
634
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
635
- }));
636
- const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
637
- return ff_compiler_Substitution.Substitution_substituteExtendDefinition(self_, _w1)
638
- }));
639
- const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
640
- return ff_compiler_Substitution.Substitution_substituteInstanceDefinition(self_, _w1)
641
- }));
642
- {
643
- const _1 = module_;
644
- {
645
- const _c = _1;
646
- return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, _c.traits_, instances_, extends_, lets_, functions_)
647
- return
648
- }
649
- }
650
- }
651
-
652
- export async function Substitution_substituteLetDefinition$(self_, definition_, $task) {
653
- {
654
- const _1 = definition_;
655
- {
656
- const _c = _1;
657
- return ff_compiler_Syntax.DLet(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.variableType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, definition_.value_))
658
- return
659
- }
660
- }
661
- }
662
-
663
- export async function Substitution_substituteExtendDefinition$(self_, definition_, $task) {
664
- {
665
- const _1 = definition_;
666
- {
667
- const _c = _1;
668
- return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
669
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
670
- })))
671
- return
672
- }
673
- }
674
- }
675
-
676
- export async function Substitution_substituteFunctionDefinition$(self_, definition_, $task) {
677
- {
678
- const _1 = definition_;
679
- {
680
- const _c = _1;
681
- return ff_compiler_Syntax.DFunction(_c.at_, ff_compiler_Substitution.Substitution_substituteSignature(self_, definition_.signature_), ff_compiler_Syntax.Target_mapFirefly(definition_.body_, ((_w1) => {
682
- return ff_compiler_Substitution.Substitution_substituteLambda(self_, _w1)
683
- })))
684
- return
685
- }
686
- }
687
- }
688
-
689
- export async function Substitution_substituteSignature$(self_, signature_, $task) {
690
- {
691
- const _1 = signature_;
692
- {
693
- const _c = _1;
694
- return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, ff_core_List.List_map(signature_.constraints_, ((_w1) => {
695
- return ff_compiler_Substitution.Substitution_substituteConstraint(self_, _w1)
696
- })), ff_core_List.List_map(signature_.parameters_, ((_w1) => {
697
- return ff_compiler_Substitution.Substitution_substituteParameter(self_, _w1)
698
- })), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.returnType_), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.effect_))
699
- return
700
- }
701
- }
702
- }
703
-
704
- export async function Substitution_substituteConstraint$(self_, constraint_, $task) {
705
- {
706
- const _1 = constraint_;
707
- {
708
- const _c = _1;
709
- return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.List_map(constraint_.generics_, ((_w1) => {
710
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
711
- })))
712
- return
713
- }
714
- }
715
- }
716
-
717
- export async function Substitution_substituteParameter$(self_, parameter_, $task) {
718
- {
719
- const _1 = parameter_;
720
- {
721
- const _c = _1;
722
- return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, parameter_.valueType_), ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
723
- return ff_compiler_Substitution.Substitution_substituteTerm(self_, _w1)
724
- })))
725
- return
726
- }
727
- }
728
- }
729
-
730
- export async function Substitution_substituteInstanceDefinition$(self_, definition_, $task) {
731
- {
732
- const _1 = definition_;
733
- {
734
- const _c = _1;
735
- return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
736
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
737
- })), _c.derived_)
738
- return
739
- }
740
- }
741
- }
742
-
743
- export async function Substitution_substituteLambda$(self_, definition_, $task) {
744
- {
745
- const _1 = definition_;
746
- {
747
- const _c = _1;
748
- return ff_compiler_Syntax.Lambda(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.effect_), ff_core_List.List_map(definition_.cases_, ((case_) => {
749
- {
750
- const _1 = case_;
751
- {
752
- const _c = _1;
753
- return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_List.List_map(case_.guards_, ((g_) => {
754
- {
755
- const _1 = g_;
756
- {
757
- const _c = _1;
758
- return ff_compiler_Syntax.MatchGuard(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, g_.term_), _c.pattern_)
759
- return
760
- }
761
- }
762
- })), ff_compiler_Substitution.Substitution_substituteTerm(self_, case_.body_))
763
- return
764
- }
765
- }
766
- })))
767
- return
768
- }
769
- }
770
- }
771
-
772
- export async function Substitution_substituteTerm$(self_, term_, $task) {
773
- {
774
- const _1 = term_;
775
- {
776
- if(_1.EString) {
777
- return term_
778
- return
779
- }
780
- }
781
- {
782
- if(_1.EChar) {
783
- return term_
784
- return
785
- }
786
- }
787
- {
788
- if(_1.EInt) {
789
- return term_
790
- return
791
- }
792
- }
793
- {
794
- if(_1.EFloat) {
795
- return term_
796
- return
797
- }
798
- }
799
- {
800
- if(_1.EVariable) {
801
- return term_
802
- return
803
- }
804
- }
805
- {
806
- if(_1.EField) {
807
- const e_ = _1;
808
- {
809
- const _1 = e_;
810
- {
811
- const _c = _1;
812
- return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_)
813
- return
814
- }
815
- }
816
- return
817
- }
818
- }
819
- {
820
- if(_1.EWildcard) {
821
- const e_ = _1;
822
- return term_
823
- return
824
- }
825
- }
826
- {
827
- if(_1.EList) {
828
- const e_ = _1;
829
- {
830
- const _1 = e_;
831
- {
832
- const _c = _1;
833
- return ff_compiler_Syntax.EList(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.elementType_), ff_core_List.List_map(e_.items_, ((_1) => {
834
- {
835
- const item_ = _1.first_;
836
- const b_ = _1.second_;
837
- return ff_core_Pair.Pair(ff_compiler_Substitution.Substitution_substituteTerm(self_, item_), b_)
838
- return
839
- }
840
- })))
841
- return
842
- }
843
- }
844
- return
845
- }
846
- }
847
- {
848
- if(_1.ESequential) {
849
- const e_ = _1;
850
- {
851
- const _1 = e_;
852
- {
853
- const _c = _1;
854
- return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.before_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.after_))
855
- return
856
- }
857
- }
858
- return
859
- }
860
- }
861
- {
862
- if(_1.ELet) {
863
- const e_ = _1;
864
- {
865
- const _1 = e_;
866
- {
867
- const _c = _1;
868
- return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.valueType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
869
- return
870
- }
871
- }
872
- return
873
- }
874
- }
875
- {
876
- if(_1.ELambda) {
877
- const e_ = _1;
878
- {
879
- const _1 = e_;
880
- {
881
- const _c = _1;
882
- return ff_compiler_Syntax.ELambda(_c.at_, ff_compiler_Substitution.Substitution_substituteLambda(self_, e_.lambda_))
883
- return
884
- }
885
- }
886
- return
887
- }
888
- }
889
- {
890
- if(_1.EVariant) {
891
- const e_ = _1;
892
- {
893
- const _1 = e_;
894
- {
895
- const _c = _1;
896
- return ff_compiler_Syntax.EVariant(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
897
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
898
- })), ff_core_Option.Option_map(e_.arguments_, ((_w1) => {
899
- return ff_core_List.List_map(_w1, ((_w1) => {
900
- return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
901
- }))
902
- })))
903
- return
904
- }
905
- }
906
- return
907
- }
908
- }
909
- {
910
- if(_1.EVariantIs) {
911
- const e_ = _1;
912
- {
913
- const _1 = e_;
914
- {
915
- const _c = _1;
916
- return ff_compiler_Syntax.EVariantIs(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
917
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
918
- })))
919
- return
920
- }
921
- }
922
- return
923
- }
924
- }
925
- {
926
- if(_1.ECopy) {
927
- const e_ = _1;
928
- {
929
- const _1 = e_;
930
- {
931
- const _c = _1;
932
- return ff_compiler_Syntax.ECopy(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), ff_core_List.List_map(e_.arguments_, ((_w1) => {
933
- return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
934
- })))
935
- return
936
- }
937
- }
938
- return
939
- }
940
- }
941
- {
942
- if(_1.EPipe) {
943
- const e_ = _1;
944
- {
945
- const _1 = e_;
946
- {
947
- const _c = _1;
948
- return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.function_))
949
- return
950
- }
951
- }
952
- return
953
- }
954
- }
955
- {
956
- if(_1.ECall) {
957
- const e_ = _1;
958
- {
959
- const _1 = e_;
960
- {
961
- const _c = _1;
962
- return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
963
- {
964
- if(_1.DynamicCall) {
965
- const call_ = _1;
966
- {
967
- const _1 = call_;
968
- {
969
- const _c = _1;
970
- return ff_compiler_Syntax.DynamicCall(ff_compiler_Substitution.Substitution_substituteTerm(self_, call_.function_), _c.tailCall_)
971
- return
972
- }
973
- }
974
- return
975
- }
976
- }
977
- {
978
- if(_1.StaticCall) {
979
- return e_.target_
980
- return
981
- }
982
- }
983
- }))(e_.target_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
984
- return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
985
- })), ff_core_List.List_map(e_.arguments_, ((_w1) => {
986
- return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
987
- })), _c.dictionaries_)
988
- return
989
- }
990
- }
991
- return
992
- }
993
- }
994
- {
995
- if(_1.ERecord) {
996
- const e_ = _1;
997
- {
998
- const _1 = e_;
999
- {
1000
- const _c = _1;
1001
- return ff_compiler_Syntax.ERecord(_c.at_, ff_core_List.List_map(e_.fields_, ((_w1) => {
1002
- return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
1003
- })))
1004
- return
1005
- }
1006
- }
1007
- return
1008
- }
1009
- }
1010
- {
1011
- if(_1.EFunctions) {
1012
- const e_ = _1;
1013
- {
1014
- const _1 = e_;
1015
- {
1016
- const _c = _1;
1017
- return ff_compiler_Syntax.EFunctions(_c.at_, ff_core_List.List_map(e_.functions_, ((_w1) => {
1018
- return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
1019
- })), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
1020
- return
1021
- }
1022
- }
1023
- return
1024
- }
1025
- }
1026
- {
1027
- if(_1.EAssign) {
1028
- const e_ = _1;
1029
- {
1030
- const _1 = e_;
1031
- {
1032
- const _c = _1;
1033
- return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
1034
- return
1035
- }
1036
- }
1037
- return
1038
- }
1039
- }
1040
- {
1041
- if(_1.EAssignField) {
1042
- const e_ = _1;
1043
- {
1044
- const _1 = e_;
1045
- {
1046
- const _c = _1;
1047
- return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
1048
- return
1049
- }
1050
- }
1051
- return
1052
- }
1053
- }
1054
- }
1055
- }
1056
-
1057
- export async function Substitution_substituteArgument$(self_, argument_, $task) {
1058
- {
1059
- const _1 = argument_;
1060
- {
1061
- const _c = _1;
1062
- return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, argument_.value_))
1063
- return
1064
- }
1065
- }
1066
- }
1067
-
1068
- export async function Substitution_substituteField$(self_, field_, $task) {
1069
- {
1070
- const _1 = field_;
1071
- {
1072
- const _c = _1;
1073
- return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, field_.value_))
1074
- return
1075
- }
1076
- }
1077
- }
1078
-
1079
- export async function Substitution_substituteType$(self_, type_, $task) {
1080
- {
1081
- const self_a = self_;
1082
- const type_a = type_;
1083
- {
1084
- if(type_a.TVariable) {
1085
- const at_ = type_a.at_;
1086
- const i_ = type_a.index_;
1087
- if(ff_compiler_Substitution.Substitution_has(self_, i_)) {
1088
- return ff_compiler_Substitution.Substitution_substituteType(self_, ff_compiler_Substitution.Substitution_get(self_, i_))
1089
- } else {
1090
- return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
1091
- }
1092
- return
1093
- }
1094
- }
1095
- {
1096
- if(type_a.TConstructor) {
1097
- const t_ = type_a;
1098
- {
1099
- const _1 = t_;
1100
- {
1101
- const _c = _1;
1102
- return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
1103
- return ff_compiler_Substitution.Substitution_substituteType(self_, t_)
1104
- })))
1105
- return
1106
- }
1107
- }
1108
- return
1109
- }
1110
- }
1111
- }
1112
- }
1113
-
1114
- export async function Substitution_get$(self_, index_, $task) {
1115
- {
1116
- const _1 = ff_core_Map.Map_grab(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1117
- {
1118
- if(_1.TVariable) {
1119
- const i_ = _1.index_;
1120
- const _guard1 = ff_compiler_Substitution.Substitution_has(self_, i_);
1121
- if(_guard1) {
1122
- const t_ = ff_compiler_Substitution.Substitution_get(self_, i_);
1123
- self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1124
- return t_
1125
- return
1126
- }
1127
- }
1128
- }
1129
- {
1130
- if(_1.TVariable) {
1131
- const at_ = _1.at_;
1132
- return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
1133
- return
1134
- }
1135
- }
1136
- {
1137
- const t_ = _1;
1138
- return t_
1139
- return
1140
- }
1141
- }
1142
- }
1143
-
1144
- export async function Substitution_has$(self_, index_, $task) {
1145
- return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1146
- }
1147
-
1148
-
1149
-
1150
-
1
+
2
+
3
+ import * as ff_compiler_Substitution from "../../ff/compiler/Substitution.mjs"
4
+
5
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
6
+
7
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
8
+
9
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
10
+
11
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
12
+
13
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
14
+
15
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
16
+
17
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
18
+
19
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
20
+
21
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
22
+
23
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
24
+
25
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
26
+
27
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
28
+
29
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
30
+
31
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
32
+
33
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
34
+
35
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
36
+
37
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
38
+
39
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
40
+
41
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
42
+
43
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
44
+
45
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
46
+
47
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
48
+
49
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
50
+
51
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
52
+
53
+ import * as ff_core_List from "../../ff/core/List.mjs"
54
+
55
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
56
+
57
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
58
+
59
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
60
+
61
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
62
+
63
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
64
+
65
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
66
+
67
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
68
+
69
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
70
+
71
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
72
+
73
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
+
75
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
76
+
77
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
+
79
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
+
81
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
+
83
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
+
85
+ import * as ff_core_String from "../../ff/core/String.mjs"
86
+
87
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
88
+
89
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
90
+
91
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
92
+
93
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
94
+
95
+ // type Substitution
96
+ export function Substitution(substitution_) {
97
+ return {substitution_};
98
+ }
99
+
100
+
101
+
102
+ export function core_(name_) {
103
+ return ((("ff:core/" + name_) + ".") + name_)
104
+ }
105
+
106
+ export async function core_$(name_, $task) {
107
+ return ((("ff:core/" + name_) + ".") + name_)
108
+ }
109
+
110
+ export function Substitution_substituteModule(self_, module_) {
111
+ const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
112
+ return ff_compiler_Substitution.Substitution_substituteLetDefinition(self_, _w1)
113
+ }));
114
+ const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
115
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
116
+ }));
117
+ const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
118
+ return ff_compiler_Substitution.Substitution_substituteExtendDefinition(self_, _w1)
119
+ }));
120
+ const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
121
+ return ff_compiler_Substitution.Substitution_substituteInstanceDefinition(self_, _w1)
122
+ }));
123
+ {
124
+ const _1 = module_;
125
+ {
126
+ const _c = _1;
127
+ return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, _c.traits_, instances_, extends_, lets_, functions_)
128
+ return
129
+ }
130
+ }
131
+ }
132
+
133
+ export function Substitution_substituteLetDefinition(self_, definition_) {
134
+ {
135
+ const _1 = definition_;
136
+ {
137
+ const _c = _1;
138
+ return ff_compiler_Syntax.DLet(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.variableType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, definition_.value_))
139
+ return
140
+ }
141
+ }
142
+ }
143
+
144
+ export function Substitution_substituteExtendDefinition(self_, definition_) {
145
+ {
146
+ const _1 = definition_;
147
+ {
148
+ const _c = _1;
149
+ return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
150
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
151
+ })))
152
+ return
153
+ }
154
+ }
155
+ }
156
+
157
+ export function Substitution_substituteFunctionDefinition(self_, definition_) {
158
+ {
159
+ const _1 = definition_;
160
+ {
161
+ const _c = _1;
162
+ return ff_compiler_Syntax.DFunction(_c.at_, ff_compiler_Substitution.Substitution_substituteSignature(self_, definition_.signature_), ff_compiler_Syntax.Target_mapFirefly(definition_.body_, ((_w1) => {
163
+ return ff_compiler_Substitution.Substitution_substituteLambda(self_, _w1)
164
+ })))
165
+ return
166
+ }
167
+ }
168
+ }
169
+
170
+ export function Substitution_substituteSignature(self_, signature_) {
171
+ {
172
+ const _1 = signature_;
173
+ {
174
+ const _c = _1;
175
+ return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, ff_core_List.List_map(signature_.constraints_, ((_w1) => {
176
+ return ff_compiler_Substitution.Substitution_substituteConstraint(self_, _w1)
177
+ })), ff_core_List.List_map(signature_.parameters_, ((_w1) => {
178
+ return ff_compiler_Substitution.Substitution_substituteParameter(self_, _w1)
179
+ })), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.returnType_), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.effect_))
180
+ return
181
+ }
182
+ }
183
+ }
184
+
185
+ export function Substitution_substituteConstraint(self_, constraint_) {
186
+ {
187
+ const _1 = constraint_;
188
+ {
189
+ const _c = _1;
190
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.List_map(constraint_.generics_, ((_w1) => {
191
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
192
+ })))
193
+ return
194
+ }
195
+ }
196
+ }
197
+
198
+ export function Substitution_substituteParameter(self_, parameter_) {
199
+ {
200
+ const _1 = parameter_;
201
+ {
202
+ const _c = _1;
203
+ return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, parameter_.valueType_), ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
204
+ return ff_compiler_Substitution.Substitution_substituteTerm(self_, _w1)
205
+ })))
206
+ return
207
+ }
208
+ }
209
+ }
210
+
211
+ export function Substitution_substituteInstanceDefinition(self_, definition_) {
212
+ {
213
+ const _1 = definition_;
214
+ {
215
+ const _c = _1;
216
+ return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
217
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
218
+ })), _c.derived_)
219
+ return
220
+ }
221
+ }
222
+ }
223
+
224
+ export function Substitution_substituteLambda(self_, definition_) {
225
+ {
226
+ const _1 = definition_;
227
+ {
228
+ const _c = _1;
229
+ return ff_compiler_Syntax.Lambda(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.effect_), ff_core_List.List_map(definition_.cases_, ((case_) => {
230
+ {
231
+ const _1 = case_;
232
+ {
233
+ const _c = _1;
234
+ return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_List.List_map(case_.guards_, ((g_) => {
235
+ {
236
+ const _1 = g_;
237
+ {
238
+ const _c = _1;
239
+ return ff_compiler_Syntax.MatchGuard(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, g_.term_), _c.pattern_)
240
+ return
241
+ }
242
+ }
243
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, case_.body_))
244
+ return
245
+ }
246
+ }
247
+ })))
248
+ return
249
+ }
250
+ }
251
+ }
252
+
253
+ export function Substitution_substituteTerm(self_, term_) {
254
+ {
255
+ const _1 = term_;
256
+ {
257
+ if(_1.EString) {
258
+ return term_
259
+ return
260
+ }
261
+ }
262
+ {
263
+ if(_1.EChar) {
264
+ return term_
265
+ return
266
+ }
267
+ }
268
+ {
269
+ if(_1.EInt) {
270
+ return term_
271
+ return
272
+ }
273
+ }
274
+ {
275
+ if(_1.EFloat) {
276
+ return term_
277
+ return
278
+ }
279
+ }
280
+ {
281
+ if(_1.EVariable) {
282
+ return term_
283
+ return
284
+ }
285
+ }
286
+ {
287
+ if(_1.EField) {
288
+ const e_ = _1;
289
+ {
290
+ const _1 = e_;
291
+ {
292
+ const _c = _1;
293
+ return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_)
294
+ return
295
+ }
296
+ }
297
+ return
298
+ }
299
+ }
300
+ {
301
+ if(_1.EWildcard) {
302
+ const e_ = _1;
303
+ return term_
304
+ return
305
+ }
306
+ }
307
+ {
308
+ if(_1.EList) {
309
+ const e_ = _1;
310
+ {
311
+ const _1 = e_;
312
+ {
313
+ const _c = _1;
314
+ return ff_compiler_Syntax.EList(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.elementType_), ff_core_List.List_map(e_.items_, ((_1) => {
315
+ {
316
+ const item_ = _1.first_;
317
+ const b_ = _1.second_;
318
+ return ff_core_Pair.Pair(ff_compiler_Substitution.Substitution_substituteTerm(self_, item_), b_)
319
+ return
320
+ }
321
+ })))
322
+ return
323
+ }
324
+ }
325
+ return
326
+ }
327
+ }
328
+ {
329
+ if(_1.ESequential) {
330
+ const e_ = _1;
331
+ {
332
+ const _1 = e_;
333
+ {
334
+ const _c = _1;
335
+ return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.before_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.after_))
336
+ return
337
+ }
338
+ }
339
+ return
340
+ }
341
+ }
342
+ {
343
+ if(_1.ELet) {
344
+ const e_ = _1;
345
+ {
346
+ const _1 = e_;
347
+ {
348
+ const _c = _1;
349
+ return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.valueType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
350
+ return
351
+ }
352
+ }
353
+ return
354
+ }
355
+ }
356
+ {
357
+ if(_1.ELambda) {
358
+ const e_ = _1;
359
+ {
360
+ const _1 = e_;
361
+ {
362
+ const _c = _1;
363
+ return ff_compiler_Syntax.ELambda(_c.at_, ff_compiler_Substitution.Substitution_substituteLambda(self_, e_.lambda_))
364
+ return
365
+ }
366
+ }
367
+ return
368
+ }
369
+ }
370
+ {
371
+ if(_1.EVariant) {
372
+ const e_ = _1;
373
+ {
374
+ const _1 = e_;
375
+ {
376
+ const _c = _1;
377
+ return ff_compiler_Syntax.EVariant(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
378
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
379
+ })), ff_core_Option.Option_map(e_.arguments_, ((_w1) => {
380
+ return ff_core_List.List_map(_w1, ((_w1) => {
381
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
382
+ }))
383
+ })))
384
+ return
385
+ }
386
+ }
387
+ return
388
+ }
389
+ }
390
+ {
391
+ if(_1.EVariantIs) {
392
+ const e_ = _1;
393
+ {
394
+ const _1 = e_;
395
+ {
396
+ const _c = _1;
397
+ return ff_compiler_Syntax.EVariantIs(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
398
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
399
+ })))
400
+ return
401
+ }
402
+ }
403
+ return
404
+ }
405
+ }
406
+ {
407
+ if(_1.ECopy) {
408
+ const e_ = _1;
409
+ {
410
+ const _1 = e_;
411
+ {
412
+ const _c = _1;
413
+ return ff_compiler_Syntax.ECopy(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), ff_core_List.List_map(e_.arguments_, ((_w1) => {
414
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
415
+ })))
416
+ return
417
+ }
418
+ }
419
+ return
420
+ }
421
+ }
422
+ {
423
+ if(_1.EPipe) {
424
+ const e_ = _1;
425
+ {
426
+ const _1 = e_;
427
+ {
428
+ const _c = _1;
429
+ return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.function_))
430
+ return
431
+ }
432
+ }
433
+ return
434
+ }
435
+ }
436
+ {
437
+ if(_1.ECall) {
438
+ const e_ = _1;
439
+ {
440
+ const _1 = e_;
441
+ {
442
+ const _c = _1;
443
+ return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
444
+ {
445
+ if(_1.DynamicCall) {
446
+ const call_ = _1;
447
+ {
448
+ const _1 = call_;
449
+ {
450
+ const _c = _1;
451
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Substitution.Substitution_substituteTerm(self_, call_.function_), _c.tailCall_)
452
+ return
453
+ }
454
+ }
455
+ return
456
+ }
457
+ }
458
+ {
459
+ if(_1.StaticCall) {
460
+ return e_.target_
461
+ return
462
+ }
463
+ }
464
+ }))(e_.target_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
465
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
466
+ })), ff_core_List.List_map(e_.arguments_, ((_w1) => {
467
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
468
+ })), _c.dictionaries_)
469
+ return
470
+ }
471
+ }
472
+ return
473
+ }
474
+ }
475
+ {
476
+ if(_1.ERecord) {
477
+ const e_ = _1;
478
+ {
479
+ const _1 = e_;
480
+ {
481
+ const _c = _1;
482
+ return ff_compiler_Syntax.ERecord(_c.at_, ff_core_List.List_map(e_.fields_, ((_w1) => {
483
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
484
+ })))
485
+ return
486
+ }
487
+ }
488
+ return
489
+ }
490
+ }
491
+ {
492
+ if(_1.EFunctions) {
493
+ const e_ = _1;
494
+ {
495
+ const _1 = e_;
496
+ {
497
+ const _c = _1;
498
+ return ff_compiler_Syntax.EFunctions(_c.at_, ff_core_List.List_map(e_.functions_, ((_w1) => {
499
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
500
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
501
+ return
502
+ }
503
+ }
504
+ return
505
+ }
506
+ }
507
+ {
508
+ if(_1.EAssign) {
509
+ const e_ = _1;
510
+ {
511
+ const _1 = e_;
512
+ {
513
+ const _c = _1;
514
+ return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
515
+ return
516
+ }
517
+ }
518
+ return
519
+ }
520
+ }
521
+ {
522
+ if(_1.EAssignField) {
523
+ const e_ = _1;
524
+ {
525
+ const _1 = e_;
526
+ {
527
+ const _c = _1;
528
+ return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
529
+ return
530
+ }
531
+ }
532
+ return
533
+ }
534
+ }
535
+ }
536
+ }
537
+
538
+ export function Substitution_substituteArgument(self_, argument_) {
539
+ {
540
+ const _1 = argument_;
541
+ {
542
+ const _c = _1;
543
+ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, argument_.value_))
544
+ return
545
+ }
546
+ }
547
+ }
548
+
549
+ export function Substitution_substituteField(self_, field_) {
550
+ {
551
+ const _1 = field_;
552
+ {
553
+ const _c = _1;
554
+ return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, field_.value_))
555
+ return
556
+ }
557
+ }
558
+ }
559
+
560
+ export function Substitution_substituteType(self_, type_) {
561
+ {
562
+ const self_a = self_;
563
+ const type_a = type_;
564
+ {
565
+ if(type_a.TVariable) {
566
+ const at_ = type_a.at_;
567
+ const i_ = type_a.index_;
568
+ if(ff_compiler_Substitution.Substitution_has(self_, i_)) {
569
+ return ff_compiler_Substitution.Substitution_substituteType(self_, ff_compiler_Substitution.Substitution_get(self_, i_))
570
+ } else {
571
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
572
+ }
573
+ return
574
+ }
575
+ }
576
+ {
577
+ if(type_a.TConstructor) {
578
+ const t_ = type_a;
579
+ {
580
+ const _1 = t_;
581
+ {
582
+ const _c = _1;
583
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
584
+ return ff_compiler_Substitution.Substitution_substituteType(self_, t_)
585
+ })))
586
+ return
587
+ }
588
+ }
589
+ return
590
+ }
591
+ }
592
+ }
593
+ }
594
+
595
+ export function Substitution_get(self_, index_) {
596
+ {
597
+ const _1 = ff_core_Map.Map_grab(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
598
+ {
599
+ if(_1.TVariable) {
600
+ const i_ = _1.index_;
601
+ const _guard1 = ff_compiler_Substitution.Substitution_has(self_, i_);
602
+ if(_guard1) {
603
+ const t_ = ff_compiler_Substitution.Substitution_get(self_, i_);
604
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
605
+ return t_
606
+ return
607
+ }
608
+ }
609
+ }
610
+ {
611
+ if(_1.TVariable) {
612
+ const at_ = _1.at_;
613
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
614
+ return
615
+ }
616
+ }
617
+ {
618
+ const t_ = _1;
619
+ return t_
620
+ return
621
+ }
622
+ }
623
+ }
624
+
625
+ export function Substitution_has(self_, index_) {
626
+ return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
627
+ }
628
+
629
+ export async function Substitution_substituteModule$(self_, module_, $task) {
630
+ const lets_ = ff_core_List.List_map(module_.lets_, ((_w1) => {
631
+ return ff_compiler_Substitution.Substitution_substituteLetDefinition(self_, _w1)
632
+ }));
633
+ const functions_ = ff_core_List.List_map(module_.functions_, ((_w1) => {
634
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
635
+ }));
636
+ const extends_ = ff_core_List.List_map(module_.extends_, ((_w1) => {
637
+ return ff_compiler_Substitution.Substitution_substituteExtendDefinition(self_, _w1)
638
+ }));
639
+ const instances_ = ff_core_List.List_map(module_.instances_, ((_w1) => {
640
+ return ff_compiler_Substitution.Substitution_substituteInstanceDefinition(self_, _w1)
641
+ }));
642
+ {
643
+ const _1 = module_;
644
+ {
645
+ const _c = _1;
646
+ return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, _c.imports_, _c.types_, _c.traits_, instances_, extends_, lets_, functions_)
647
+ return
648
+ }
649
+ }
650
+ }
651
+
652
+ export async function Substitution_substituteLetDefinition$(self_, definition_, $task) {
653
+ {
654
+ const _1 = definition_;
655
+ {
656
+ const _c = _1;
657
+ return ff_compiler_Syntax.DLet(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.variableType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, definition_.value_))
658
+ return
659
+ }
660
+ }
661
+ }
662
+
663
+ export async function Substitution_substituteExtendDefinition$(self_, definition_, $task) {
664
+ {
665
+ const _1 = definition_;
666
+ {
667
+ const _c = _1;
668
+ return ff_compiler_Syntax.DExtend(_c.at_, _c.name_, _c.generics_, _c.constraints_, _c.type_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
669
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
670
+ })))
671
+ return
672
+ }
673
+ }
674
+ }
675
+
676
+ export async function Substitution_substituteFunctionDefinition$(self_, definition_, $task) {
677
+ {
678
+ const _1 = definition_;
679
+ {
680
+ const _c = _1;
681
+ return ff_compiler_Syntax.DFunction(_c.at_, ff_compiler_Substitution.Substitution_substituteSignature(self_, definition_.signature_), ff_compiler_Syntax.Target_mapFirefly(definition_.body_, ((_w1) => {
682
+ return ff_compiler_Substitution.Substitution_substituteLambda(self_, _w1)
683
+ })))
684
+ return
685
+ }
686
+ }
687
+ }
688
+
689
+ export async function Substitution_substituteSignature$(self_, signature_, $task) {
690
+ {
691
+ const _1 = signature_;
692
+ {
693
+ const _c = _1;
694
+ return ff_compiler_Syntax.Signature(_c.at_, _c.name_, _c.member_, _c.generics_, ff_core_List.List_map(signature_.constraints_, ((_w1) => {
695
+ return ff_compiler_Substitution.Substitution_substituteConstraint(self_, _w1)
696
+ })), ff_core_List.List_map(signature_.parameters_, ((_w1) => {
697
+ return ff_compiler_Substitution.Substitution_substituteParameter(self_, _w1)
698
+ })), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.returnType_), ff_compiler_Substitution.Substitution_substituteType(self_, signature_.effect_))
699
+ return
700
+ }
701
+ }
702
+ }
703
+
704
+ export async function Substitution_substituteConstraint$(self_, constraint_, $task) {
705
+ {
706
+ const _1 = constraint_;
707
+ {
708
+ const _c = _1;
709
+ return ff_compiler_Syntax.Constraint(_c.at_, _c.name_, ff_core_List.List_map(constraint_.generics_, ((_w1) => {
710
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
711
+ })))
712
+ return
713
+ }
714
+ }
715
+ }
716
+
717
+ export async function Substitution_substituteParameter$(self_, parameter_, $task) {
718
+ {
719
+ const _1 = parameter_;
720
+ {
721
+ const _c = _1;
722
+ return ff_compiler_Syntax.Parameter(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, parameter_.valueType_), ff_core_Option.Option_map(parameter_.default_, ((_w1) => {
723
+ return ff_compiler_Substitution.Substitution_substituteTerm(self_, _w1)
724
+ })))
725
+ return
726
+ }
727
+ }
728
+ }
729
+
730
+ export async function Substitution_substituteInstanceDefinition$(self_, definition_, $task) {
731
+ {
732
+ const _1 = definition_;
733
+ {
734
+ const _c = _1;
735
+ return ff_compiler_Syntax.DInstance(_c.at_, _c.generics_, _c.constraints_, _c.traitName_, _c.typeArguments_, _c.generatorArguments_, ff_core_List.List_map(definition_.methods_, ((_w1) => {
736
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
737
+ })), _c.derived_)
738
+ return
739
+ }
740
+ }
741
+ }
742
+
743
+ export async function Substitution_substituteLambda$(self_, definition_, $task) {
744
+ {
745
+ const _1 = definition_;
746
+ {
747
+ const _c = _1;
748
+ return ff_compiler_Syntax.Lambda(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, definition_.effect_), ff_core_List.List_map(definition_.cases_, ((case_) => {
749
+ {
750
+ const _1 = case_;
751
+ {
752
+ const _c = _1;
753
+ return ff_compiler_Syntax.MatchCase(_c.at_, _c.patterns_, ff_core_List.List_map(case_.guards_, ((g_) => {
754
+ {
755
+ const _1 = g_;
756
+ {
757
+ const _c = _1;
758
+ return ff_compiler_Syntax.MatchGuard(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, g_.term_), _c.pattern_)
759
+ return
760
+ }
761
+ }
762
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, case_.body_))
763
+ return
764
+ }
765
+ }
766
+ })))
767
+ return
768
+ }
769
+ }
770
+ }
771
+
772
+ export async function Substitution_substituteTerm$(self_, term_, $task) {
773
+ {
774
+ const _1 = term_;
775
+ {
776
+ if(_1.EString) {
777
+ return term_
778
+ return
779
+ }
780
+ }
781
+ {
782
+ if(_1.EChar) {
783
+ return term_
784
+ return
785
+ }
786
+ }
787
+ {
788
+ if(_1.EInt) {
789
+ return term_
790
+ return
791
+ }
792
+ }
793
+ {
794
+ if(_1.EFloat) {
795
+ return term_
796
+ return
797
+ }
798
+ }
799
+ {
800
+ if(_1.EVariable) {
801
+ return term_
802
+ return
803
+ }
804
+ }
805
+ {
806
+ if(_1.EField) {
807
+ const e_ = _1;
808
+ {
809
+ const _1 = e_;
810
+ {
811
+ const _c = _1;
812
+ return ff_compiler_Syntax.EField(_c.at_, _c.newtype_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_)
813
+ return
814
+ }
815
+ }
816
+ return
817
+ }
818
+ }
819
+ {
820
+ if(_1.EWildcard) {
821
+ const e_ = _1;
822
+ return term_
823
+ return
824
+ }
825
+ }
826
+ {
827
+ if(_1.EList) {
828
+ const e_ = _1;
829
+ {
830
+ const _1 = e_;
831
+ {
832
+ const _c = _1;
833
+ return ff_compiler_Syntax.EList(_c.at_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.elementType_), ff_core_List.List_map(e_.items_, ((_1) => {
834
+ {
835
+ const item_ = _1.first_;
836
+ const b_ = _1.second_;
837
+ return ff_core_Pair.Pair(ff_compiler_Substitution.Substitution_substituteTerm(self_, item_), b_)
838
+ return
839
+ }
840
+ })))
841
+ return
842
+ }
843
+ }
844
+ return
845
+ }
846
+ }
847
+ {
848
+ if(_1.ESequential) {
849
+ const e_ = _1;
850
+ {
851
+ const _1 = e_;
852
+ {
853
+ const _c = _1;
854
+ return ff_compiler_Syntax.ESequential(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.before_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.after_))
855
+ return
856
+ }
857
+ }
858
+ return
859
+ }
860
+ }
861
+ {
862
+ if(_1.ELet) {
863
+ const e_ = _1;
864
+ {
865
+ const _1 = e_;
866
+ {
867
+ const _c = _1;
868
+ return ff_compiler_Syntax.ELet(_c.at_, _c.mutable_, _c.name_, ff_compiler_Substitution.Substitution_substituteType(self_, e_.valueType_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
869
+ return
870
+ }
871
+ }
872
+ return
873
+ }
874
+ }
875
+ {
876
+ if(_1.ELambda) {
877
+ const e_ = _1;
878
+ {
879
+ const _1 = e_;
880
+ {
881
+ const _c = _1;
882
+ return ff_compiler_Syntax.ELambda(_c.at_, ff_compiler_Substitution.Substitution_substituteLambda(self_, e_.lambda_))
883
+ return
884
+ }
885
+ }
886
+ return
887
+ }
888
+ }
889
+ {
890
+ if(_1.EVariant) {
891
+ const e_ = _1;
892
+ {
893
+ const _1 = e_;
894
+ {
895
+ const _c = _1;
896
+ return ff_compiler_Syntax.EVariant(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
897
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
898
+ })), ff_core_Option.Option_map(e_.arguments_, ((_w1) => {
899
+ return ff_core_List.List_map(_w1, ((_w1) => {
900
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
901
+ }))
902
+ })))
903
+ return
904
+ }
905
+ }
906
+ return
907
+ }
908
+ }
909
+ {
910
+ if(_1.EVariantIs) {
911
+ const e_ = _1;
912
+ {
913
+ const _1 = e_;
914
+ {
915
+ const _c = _1;
916
+ return ff_compiler_Syntax.EVariantIs(_c.at_, _c.name_, ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
917
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
918
+ })))
919
+ return
920
+ }
921
+ }
922
+ return
923
+ }
924
+ }
925
+ {
926
+ if(_1.ECopy) {
927
+ const e_ = _1;
928
+ {
929
+ const _1 = e_;
930
+ {
931
+ const _c = _1;
932
+ return ff_compiler_Syntax.ECopy(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), ff_core_List.List_map(e_.arguments_, ((_w1) => {
933
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
934
+ })))
935
+ return
936
+ }
937
+ }
938
+ return
939
+ }
940
+ }
941
+ {
942
+ if(_1.EPipe) {
943
+ const e_ = _1;
944
+ {
945
+ const _1 = e_;
946
+ {
947
+ const _c = _1;
948
+ return ff_compiler_Syntax.EPipe(_c.at_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.function_))
949
+ return
950
+ }
951
+ }
952
+ return
953
+ }
954
+ }
955
+ {
956
+ if(_1.ECall) {
957
+ const e_ = _1;
958
+ {
959
+ const _1 = e_;
960
+ {
961
+ const _c = _1;
962
+ return ff_compiler_Syntax.ECall(_c.at_, (((_1) => {
963
+ {
964
+ if(_1.DynamicCall) {
965
+ const call_ = _1;
966
+ {
967
+ const _1 = call_;
968
+ {
969
+ const _c = _1;
970
+ return ff_compiler_Syntax.DynamicCall(ff_compiler_Substitution.Substitution_substituteTerm(self_, call_.function_), _c.tailCall_)
971
+ return
972
+ }
973
+ }
974
+ return
975
+ }
976
+ }
977
+ {
978
+ if(_1.StaticCall) {
979
+ return e_.target_
980
+ return
981
+ }
982
+ }
983
+ }))(e_.target_), ff_compiler_Substitution.Substitution_substituteType(self_, e_.effect_), ff_core_List.List_map(e_.typeArguments_, ((_w1) => {
984
+ return ff_compiler_Substitution.Substitution_substituteType(self_, _w1)
985
+ })), ff_core_List.List_map(e_.arguments_, ((_w1) => {
986
+ return ff_compiler_Substitution.Substitution_substituteArgument(self_, _w1)
987
+ })), _c.dictionaries_)
988
+ return
989
+ }
990
+ }
991
+ return
992
+ }
993
+ }
994
+ {
995
+ if(_1.ERecord) {
996
+ const e_ = _1;
997
+ {
998
+ const _1 = e_;
999
+ {
1000
+ const _c = _1;
1001
+ return ff_compiler_Syntax.ERecord(_c.at_, ff_core_List.List_map(e_.fields_, ((_w1) => {
1002
+ return ff_compiler_Substitution.Substitution_substituteField(self_, _w1)
1003
+ })))
1004
+ return
1005
+ }
1006
+ }
1007
+ return
1008
+ }
1009
+ }
1010
+ {
1011
+ if(_1.EFunctions) {
1012
+ const e_ = _1;
1013
+ {
1014
+ const _1 = e_;
1015
+ {
1016
+ const _c = _1;
1017
+ return ff_compiler_Syntax.EFunctions(_c.at_, ff_core_List.List_map(e_.functions_, ((_w1) => {
1018
+ return ff_compiler_Substitution.Substitution_substituteFunctionDefinition(self_, _w1)
1019
+ })), ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.body_))
1020
+ return
1021
+ }
1022
+ }
1023
+ return
1024
+ }
1025
+ }
1026
+ {
1027
+ if(_1.EAssign) {
1028
+ const e_ = _1;
1029
+ {
1030
+ const _1 = e_;
1031
+ {
1032
+ const _c = _1;
1033
+ return ff_compiler_Syntax.EAssign(_c.at_, _c.operator_, _c.variable_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
1034
+ return
1035
+ }
1036
+ }
1037
+ return
1038
+ }
1039
+ }
1040
+ {
1041
+ if(_1.EAssignField) {
1042
+ const e_ = _1;
1043
+ {
1044
+ const _1 = e_;
1045
+ {
1046
+ const _c = _1;
1047
+ return ff_compiler_Syntax.EAssignField(_c.at_, _c.operator_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.record_), _c.field_, ff_compiler_Substitution.Substitution_substituteTerm(self_, e_.value_))
1048
+ return
1049
+ }
1050
+ }
1051
+ return
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+
1057
+ export async function Substitution_substituteArgument$(self_, argument_, $task) {
1058
+ {
1059
+ const _1 = argument_;
1060
+ {
1061
+ const _c = _1;
1062
+ return ff_compiler_Syntax.Argument(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, argument_.value_))
1063
+ return
1064
+ }
1065
+ }
1066
+ }
1067
+
1068
+ export async function Substitution_substituteField$(self_, field_, $task) {
1069
+ {
1070
+ const _1 = field_;
1071
+ {
1072
+ const _c = _1;
1073
+ return ff_compiler_Syntax.Field(_c.at_, _c.name_, ff_compiler_Substitution.Substitution_substituteTerm(self_, field_.value_))
1074
+ return
1075
+ }
1076
+ }
1077
+ }
1078
+
1079
+ export async function Substitution_substituteType$(self_, type_, $task) {
1080
+ {
1081
+ const self_a = self_;
1082
+ const type_a = type_;
1083
+ {
1084
+ if(type_a.TVariable) {
1085
+ const at_ = type_a.at_;
1086
+ const i_ = type_a.index_;
1087
+ if(ff_compiler_Substitution.Substitution_has(self_, i_)) {
1088
+ return ff_compiler_Substitution.Substitution_substituteType(self_, ff_compiler_Substitution.Substitution_get(self_, i_))
1089
+ } else {
1090
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
1091
+ }
1092
+ return
1093
+ }
1094
+ }
1095
+ {
1096
+ if(type_a.TConstructor) {
1097
+ const t_ = type_a;
1098
+ {
1099
+ const _1 = t_;
1100
+ {
1101
+ const _c = _1;
1102
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
1103
+ return ff_compiler_Substitution.Substitution_substituteType(self_, t_)
1104
+ })))
1105
+ return
1106
+ }
1107
+ }
1108
+ return
1109
+ }
1110
+ }
1111
+ }
1112
+ }
1113
+
1114
+ export async function Substitution_get$(self_, index_, $task) {
1115
+ {
1116
+ const _1 = ff_core_Map.Map_grab(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1117
+ {
1118
+ if(_1.TVariable) {
1119
+ const i_ = _1.index_;
1120
+ const _guard1 = ff_compiler_Substitution.Substitution_has(self_, i_);
1121
+ if(_guard1) {
1122
+ const t_ = ff_compiler_Substitution.Substitution_get(self_, i_);
1123
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1124
+ return t_
1125
+ return
1126
+ }
1127
+ }
1128
+ }
1129
+ {
1130
+ if(_1.TVariable) {
1131
+ const at_ = _1.at_;
1132
+ return ff_compiler_Syntax.TConstructor(at_, ff_compiler_Substitution.core_("Nothing"), ff_core_List.Empty())
1133
+ return
1134
+ }
1135
+ }
1136
+ {
1137
+ const t_ = _1;
1138
+ return t_
1139
+ return
1140
+ }
1141
+ }
1142
+ }
1143
+
1144
+ export async function Substitution_has$(self_, index_, $task) {
1145
+ return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1146
+ }
1147
+
1148
+
1149
+
1150
+