firefly-compiler 0.4.6 → 0.4.7

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 (68) hide show
  1. package/output/js/ff/compiler/Builder.mjs +444 -444
  2. package/output/js/ff/compiler/Compiler.mjs +416 -416
  3. package/output/js/ff/compiler/Dependencies.mjs +389 -389
  4. package/output/js/ff/compiler/Deriver.mjs +1170 -1170
  5. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1309
  6. package/output/js/ff/compiler/Environment.mjs +1015 -1015
  7. package/output/js/ff/compiler/Inference.mjs +4268 -4268
  8. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5391
  9. package/output/js/ff/compiler/JsImporter.mjs +266 -266
  10. package/output/js/ff/compiler/LspHook.mjs +793 -793
  11. package/output/js/ff/compiler/Main.mjs +1675 -1675
  12. package/output/js/ff/compiler/Parser.mjs +4008 -4008
  13. package/output/js/ff/compiler/Patterns.mjs +927 -927
  14. package/output/js/ff/compiler/Resolver.mjs +2307 -2307
  15. package/output/js/ff/compiler/Substitution.mjs +1150 -1150
  16. package/output/js/ff/compiler/Syntax.mjs +12434 -12434
  17. package/output/js/ff/compiler/Token.mjs +3096 -3096
  18. package/output/js/ff/compiler/Tokenizer.mjs +593 -593
  19. package/output/js/ff/compiler/Unification.mjs +1752 -1752
  20. package/output/js/ff/compiler/Wildcards.mjs +608 -608
  21. package/output/js/ff/compiler/Workspace.mjs +687 -687
  22. package/output/js/ff/core/Any.mjs +143 -143
  23. package/output/js/ff/core/Array.mjs +547 -547
  24. package/output/js/ff/core/AssetSystem.mjs +274 -274
  25. package/output/js/ff/core/Atomic.mjs +154 -154
  26. package/output/js/ff/core/Bool.mjs +152 -152
  27. package/output/js/ff/core/Box.mjs +112 -112
  28. package/output/js/ff/core/BrowserSystem.mjs +126 -126
  29. package/output/js/ff/core/Buffer.mjs +395 -395
  30. package/output/js/ff/core/BuildSystem.mjs +296 -296
  31. package/output/js/ff/core/Channel.mjs +189 -189
  32. package/output/js/ff/core/Char.mjs +149 -149
  33. package/output/js/ff/core/Core.mjs +300 -300
  34. package/output/js/ff/core/Duration.mjs +116 -116
  35. package/output/js/ff/core/Equal.mjs +179 -179
  36. package/output/js/ff/core/Error.mjs +142 -142
  37. package/output/js/ff/core/FileHandle.mjs +150 -150
  38. package/output/js/ff/core/Float.mjs +225 -225
  39. package/output/js/ff/core/HttpClient.mjs +191 -191
  40. package/output/js/ff/core/Instant.mjs +109 -109
  41. package/output/js/ff/core/Int.mjs +265 -265
  42. package/output/js/ff/core/IntMap.mjs +280 -280
  43. package/output/js/ff/core/JsSystem.mjs +238 -238
  44. package/output/js/ff/core/JsValue.mjs +708 -708
  45. package/output/js/ff/core/List.mjs +2334 -2334
  46. package/output/js/ff/core/Lock.mjs +229 -229
  47. package/output/js/ff/core/Log.mjs +163 -163
  48. package/output/js/ff/core/Map.mjs +362 -362
  49. package/output/js/ff/core/NodeSystem.mjs +294 -294
  50. package/output/js/ff/core/Nothing.mjs +104 -104
  51. package/output/js/ff/core/Option.mjs +1015 -1015
  52. package/output/js/ff/core/Ordering.mjs +730 -730
  53. package/output/js/ff/core/Pair.mjs +331 -331
  54. package/output/js/ff/core/Path.mjs +545 -545
  55. package/output/js/ff/core/RbMap.mjs +1940 -1940
  56. package/output/js/ff/core/Serializable.mjs +428 -428
  57. package/output/js/ff/core/Set.mjs +254 -254
  58. package/output/js/ff/core/Show.mjs +205 -205
  59. package/output/js/ff/core/SourceLocation.mjs +229 -229
  60. package/output/js/ff/core/Stack.mjs +529 -529
  61. package/output/js/ff/core/Stream.mjs +1304 -1304
  62. package/output/js/ff/core/String.mjs +365 -365
  63. package/output/js/ff/core/StringMap.mjs +280 -280
  64. package/output/js/ff/core/Task.mjs +320 -320
  65. package/output/js/ff/core/Try.mjs +507 -507
  66. package/output/js/ff/core/Unit.mjs +151 -151
  67. package/package.json +1 -1
  68. package/vscode/package.json +1 -1
@@ -1,1752 +1,1752 @@
1
-
2
-
3
- import * as ff_compiler_Unification from "../../ff/compiler/Unification.mjs"
4
-
5
- import * as ff_compiler_Inference from "../../ff/compiler/Inference.mjs"
6
-
7
- import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
8
-
9
- import * as ff_core_Any from "../../ff/core/Any.mjs"
10
-
11
- import * as ff_core_Array from "../../ff/core/Array.mjs"
12
-
13
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
14
-
15
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
16
-
17
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
18
-
19
- import * as ff_core_Box from "../../ff/core/Box.mjs"
20
-
21
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
22
-
23
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
24
-
25
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
26
-
27
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
28
-
29
- import * as ff_core_Char from "../../ff/core/Char.mjs"
30
-
31
- import * as ff_core_Core from "../../ff/core/Core.mjs"
32
-
33
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
34
-
35
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
36
-
37
- import * as ff_core_Error from "../../ff/core/Error.mjs"
38
-
39
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
40
-
41
- import * as ff_core_Float from "../../ff/core/Float.mjs"
42
-
43
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
44
-
45
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
46
-
47
- import * as ff_core_Int from "../../ff/core/Int.mjs"
48
-
49
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
50
-
51
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
52
-
53
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
54
-
55
- import * as ff_core_List from "../../ff/core/List.mjs"
56
-
57
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
58
-
59
- import * as ff_core_Log from "../../ff/core/Log.mjs"
60
-
61
- import * as ff_core_Map from "../../ff/core/Map.mjs"
62
-
63
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
64
-
65
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
66
-
67
- import * as ff_core_Option from "../../ff/core/Option.mjs"
68
-
69
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
70
-
71
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
72
-
73
- import * as ff_core_Path from "../../ff/core/Path.mjs"
74
-
75
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
76
-
77
- import * as ff_core_Set from "../../ff/core/Set.mjs"
78
-
79
- import * as ff_core_Show from "../../ff/core/Show.mjs"
80
-
81
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
82
-
83
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
84
-
85
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
86
-
87
- import * as ff_core_String from "../../ff/core/String.mjs"
88
-
89
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
90
-
91
- import * as ff_core_Task from "../../ff/core/Task.mjs"
92
-
93
- import * as ff_core_Try from "../../ff/core/Try.mjs"
94
-
95
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
96
-
97
- // type Unification
98
- export function Unification(substitution_, constraints_, nextUnificationVariableIndex_, instances_, affects_, attemptFixes_) {
99
- return {substitution_, constraints_, nextUnificationVariableIndex_, instances_, affects_, attemptFixes_};
100
- }
101
-
102
- // type ConstraintGenerics
103
- export function ConstraintGenerics(at_, generics_) {
104
- return {at_, generics_};
105
- }
106
-
107
- // type InstanceKey
108
- export function InstanceKey(traitName_, typeName_) {
109
- return {traitName_, typeName_};
110
- }
111
-
112
- // type InstanceValue
113
- export function InstanceValue(generics_, constraints_, packagePair_, moduleName_, traitName_, typeArguments_) {
114
- return {generics_, constraints_, packagePair_, moduleName_, traitName_, typeArguments_};
115
- }
116
-
117
-
118
-
119
- export function fail_(at_, message_) {
120
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
121
- }
122
-
123
- export function make_(modules_, attemptFixes_) {
124
- return ff_compiler_Unification.Unification(ff_core_Map.empty_(), ff_core_Map.empty_(), 3, ff_core_List.List_toMap(ff_core_List.List_flatMap(modules_, ((module_) => {
125
- const moduleName_ = ff_core_String.String_dropLast(module_.file_, ff_core_String.String_size(".ff"));
126
- return ff_core_List.List_map(module_.instances_, ((definition_) => {
127
- const typeName_ = (((_1) => {
128
- {
129
- if(_1.TConstructor) {
130
- const name_ = _1.name_;
131
- return name_
132
- return
133
- }
134
- }
135
- {
136
- if(_1.TVariable) {
137
- const i_ = _1.index_;
138
- return ff_compiler_Unification.fail_(definition_.at_, ("Unexpected unification variable: $" + i_))
139
- return
140
- }
141
- }
142
- }))(ff_core_List.List_grabFirst(definition_.typeArguments_));
143
- return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(definition_.traitName_, typeName_), ff_compiler_Unification.InstanceValue(definition_.generics_, definition_.constraints_, module_.packagePair_, moduleName_, definition_.traitName_, definition_.typeArguments_))
144
- }))
145
- })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey), ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), attemptFixes_)
146
- }
147
-
148
- export async function fail_$(at_, message_, $task) {
149
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
150
- }
151
-
152
- export async function make_$(modules_, attemptFixes_, $task) {
153
- return ff_compiler_Unification.Unification(ff_core_Map.empty_(), ff_core_Map.empty_(), 3, ff_core_List.List_toMap(ff_core_List.List_flatMap(modules_, ((module_) => {
154
- const moduleName_ = ff_core_String.String_dropLast(module_.file_, ff_core_String.String_size(".ff"));
155
- return ff_core_List.List_map(module_.instances_, ((definition_) => {
156
- const typeName_ = (((_1) => {
157
- {
158
- if(_1.TConstructor) {
159
- const name_ = _1.name_;
160
- return name_
161
- return
162
- }
163
- }
164
- {
165
- if(_1.TVariable) {
166
- const i_ = _1.index_;
167
- return ff_compiler_Unification.fail_(definition_.at_, ("Unexpected unification variable: $" + i_))
168
- return
169
- }
170
- }
171
- }))(ff_core_List.List_grabFirst(definition_.typeArguments_));
172
- return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(definition_.traitName_, typeName_), ff_compiler_Unification.InstanceValue(definition_.generics_, definition_.constraints_, module_.packagePair_, moduleName_, definition_.traitName_, definition_.typeArguments_))
173
- }))
174
- })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey), ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), attemptFixes_)
175
- }
176
-
177
- export function Unification_withLocalInstances(self_, instances_, body_) {
178
- const oldInstances_ = self_.instances_;
179
- self_.instances_ = ff_core_Map.Map_addAll(self_.instances_, instances_, ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
180
- try {
181
- return body_()
182
- } finally {
183
- self_.instances_ = oldInstances_
184
- }
185
- }
186
-
187
- export function Unification_freshUnificationVariable(self_, at_) {
188
- const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
189
- self_.nextUnificationVariableIndex_ += 3;
190
- return result_
191
- }
192
-
193
- export function Unification_instantiate(self_, instantiation_, type_) {
194
- {
195
- const self_a = self_;
196
- const instantiation_a = instantiation_;
197
- const type_a = type_;
198
- {
199
- if(type_a.TConstructor) {
200
- const at_ = type_a.at_;
201
- const name_ = type_a.name_;
202
- if(type_a.generics_.Empty) {
203
- {
204
- const _1 = ff_core_Map.Map_get(instantiation_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
205
- {
206
- if(_1.Some) {
207
- const t_ = _1.value_;
208
- return t_
209
- return
210
- }
211
- }
212
- {
213
- if(_1.None) {
214
- return type_
215
- return
216
- }
217
- }
218
- }
219
- return
220
- }
221
- }
222
- }
223
- {
224
- if(type_a.TConstructor) {
225
- const at_ = type_a.at_;
226
- const name_ = type_a.name_;
227
- const generics_ = type_a.generics_;
228
- return ff_compiler_Syntax.TConstructor(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
229
- return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
230
- })))
231
- return
232
- }
233
- }
234
- {
235
- if(type_a.TVariable) {
236
- const i_ = type_a.index_;
237
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
238
- if(_guard1.Some) {
239
- const t_ = _guard1.value_;
240
- return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, t_)
241
- return
242
- }
243
- }
244
- }
245
- {
246
- if(type_a.TVariable) {
247
- const i_ = type_a.index_;
248
- return type_
249
- return
250
- }
251
- }
252
- }
253
- }
254
-
255
- export function Unification_instantiateConstraint(self_, instantiation_, constraint_) {
256
- {
257
- const self_a = self_;
258
- const instantiation_a = instantiation_;
259
- const constraint_a = constraint_;
260
- {
261
- const at_ = constraint_a.at_;
262
- const name_ = constraint_a.name_;
263
- const generics_ = constraint_a.generics_;
264
- return ff_compiler_Syntax.Constraint(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
265
- return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
266
- })))
267
- return
268
- }
269
- }
270
- }
271
-
272
- export function Unification_constrain(self_, at_, type_, constraintName_, generics_) {
273
- {
274
- const _1 = type_;
275
- {
276
- if(_1.TVariable) {
277
- const i_ = _1.index_;
278
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
279
- if(_guard1.Some) {
280
- const t_ = _guard1.value_;
281
- ff_compiler_Unification.Unification_constrain(self_, at_, t_, constraintName_, generics_)
282
- return
283
- }
284
- }
285
- }
286
- {
287
- if(_1.TVariable) {
288
- const i_ = _1.index_;
289
- {
290
- const _1 = ff_core_Map.Map_get(self_.constraints_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
291
- {
292
- if(_1.None) {
293
- self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_)), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
294
- return
295
- }
296
- }
297
- {
298
- if(_1.Some) {
299
- const map_ = _1.value_;
300
- {
301
- const _1 = ff_core_Map.Map_get(map_, constraintName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
302
- {
303
- if(_1.None) {
304
- const newMap_ = ff_core_Map.Map_add(map_, constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
305
- self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, newMap_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
306
- return
307
- }
308
- }
309
- {
310
- if(_1.Some) {
311
- const generics2_ = _1.value_.generics_;
312
- ff_core_List.List_each(ff_core_List.List_zip(generics_, generics2_), ((_1) => {
313
- {
314
- const t1_ = _1.first_;
315
- const t2_ = _1.second_;
316
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
317
- return
318
- }
319
- }))
320
- return
321
- }
322
- }
323
- }
324
- return
325
- }
326
- }
327
- }
328
- return
329
- }
330
- }
331
- {
332
- if(_1.TConstructor) {
333
- const name_ = _1.name_;
334
- const generics2_ = _1.generics_;
335
- {
336
- const _1 = ff_core_Map.Map_get(self_.instances_, ff_compiler_Unification.InstanceKey(constraintName_, name_), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
337
- {
338
- if(_1.None) {
339
- const g1_ = (ff_core_List.List_isEmpty(generics_)
340
- ? ""
341
- : "[...]");
342
- const g2_ = (ff_core_List.List_isEmpty(generics2_)
343
- ? ""
344
- : "[...]");
345
- if((!self_.attemptFixes_)) {
346
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("No such instance: " + name_) + g2_) + ": ") + constraintName_) + g1_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
347
- }
348
- return
349
- }
350
- }
351
- {
352
- if(_1.Some) {
353
- const definition_ = _1.value_;
354
- const unificationVariables_ = ff_core_List.List_map(definition_.generics_, ((_) => {
355
- return ff_compiler_Unification.Unification_freshUnificationVariable(self_, at_)
356
- }));
357
- const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_.generics_, unificationVariables_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
358
- const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
359
- const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, ff_core_List.Link(type_, generics_));
360
- ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
361
- ff_core_List.List_each(definition_.constraints_, ((constraint_) => {
362
- {
363
- const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
364
- {
365
- const constraintName_ = _1.name_;
366
- const newGenerics_ = _1.generics_;
367
- ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
368
- return
369
- }
370
- }
371
- }))
372
- return
373
- }
374
- }
375
- }
376
- return
377
- }
378
- }
379
- }
380
- }
381
-
382
- export function Unification_get(self_, index_) {
383
- return ff_core_Option.Option_map(ff_core_Map.Map_get(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((_1) => {
384
- {
385
- if(_1.TVariable) {
386
- const i_ = _1.index_;
387
- const _guard1 = ff_core_Map.Map_get(self_.substitution_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
388
- if(_guard1.Some) {
389
- const t_ = _guard1.value_;
390
- self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
391
- return t_
392
- return
393
- }
394
- }
395
- }
396
- {
397
- const t_ = _1;
398
- return t_
399
- return
400
- }
401
- }))
402
- }
403
-
404
- export function Unification_substitute(self_, type_) {
405
- {
406
- const self_a = self_;
407
- const type_a = type_;
408
- {
409
- if(type_a.TVariable) {
410
- const i_ = type_a.index_;
411
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
412
- if(_guard1.Some) {
413
- const t_ = _guard1.value_;
414
- return ff_compiler_Unification.Unification_substitute(self_, t_)
415
- return
416
- }
417
- }
418
- }
419
- {
420
- if(type_a.TVariable) {
421
- return type_
422
- return
423
- }
424
- }
425
- {
426
- if(type_a.TConstructor) {
427
- const t_ = type_a;
428
- {
429
- const _1 = t_;
430
- {
431
- const _c = _1;
432
- return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
433
- return ff_compiler_Unification.Unification_substitute(self_, t_)
434
- })))
435
- return
436
- }
437
- }
438
- return
439
- }
440
- }
441
- }
442
- }
443
-
444
- export function Unification_unify(self_, at_, t1_, t2_) {
445
- {
446
- const self_a = self_;
447
- const at_a = at_;
448
- const t1_a = t1_;
449
- const t2_a = t2_;
450
- {
451
- if(t1_a.TVariable) {
452
- const i1_ = t1_a.index_;
453
- if(t2_a.TVariable) {
454
- const i2_ = t2_a.index_;
455
- const _guard1 = (i1_ === i2_);
456
- if(_guard1) {
457
-
458
- return
459
- }
460
- }
461
- }
462
- }
463
- {
464
- if(t1_a.TVariable) {
465
- const i_ = t1_a.index_;
466
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
467
- if(_guard1.Some) {
468
- const t_ = _guard1.value_;
469
- ff_compiler_Unification.Unification_unify(self_, at_, t_, t2_)
470
- return
471
- }
472
- }
473
- }
474
- {
475
- if(t2_a.TVariable) {
476
- const i_ = t2_a.index_;
477
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
478
- if(_guard1.Some) {
479
- const t_ = _guard1.value_;
480
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t_)
481
- return
482
- }
483
- }
484
- }
485
- {
486
- if(t1_a.TVariable) {
487
- const i_ = t1_a.index_;
488
- ff_compiler_Unification.Unification_bind(self_, at_, i_, t2_)
489
- return
490
- }
491
- }
492
- {
493
- if(t2_a.TVariable) {
494
- const i_ = t2_a.index_;
495
- ff_compiler_Unification.Unification_bind(self_, at_, i_, t1_)
496
- return
497
- }
498
- }
499
- {
500
- if(t1_a.TConstructor) {
501
- const name1_ = t1_a.name_;
502
- const generics1_ = t1_a.generics_;
503
- if(t2_a.TConstructor) {
504
- const name2_ = t2_a.name_;
505
- const generics2_ = t2_a.generics_;
506
- if(((name1_ !== name2_) || (ff_core_List.List_size(generics1_) !== ff_core_List.List_size(generics2_)))) {
507
- if((!self_.attemptFixes_)) {
508
- const t3_ = ff_compiler_Unification.Unification_substitute(self_, t1_);
509
- const t4_ = ff_compiler_Unification.Unification_substitute(self_, t2_);
510
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Type mismatch: " + ff_compiler_Syntax.Type_show(t3_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty())))) + " vs. ") + ff_compiler_Syntax.Type_show(t4_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty()))))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
511
- } else if((ff_core_String.String_startsWith(name1_, "Function$", 0) && ff_core_String.String_startsWith(name2_, "Function$", 0))) {
512
- ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_dropLast(generics1_, 1), ff_core_List.List_dropLast(generics2_, 1)), ((_1) => {
513
- {
514
- const t3_ = _1.first_;
515
- const t4_ = _1.second_;
516
- ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
517
- return
518
- }
519
- }));
520
- ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_takeLast(generics1_, 1), ff_core_List.List_takeLast(generics2_, 1)), ((_1) => {
521
- {
522
- const t3_ = _1.first_;
523
- const t4_ = _1.second_;
524
- ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
525
- return
526
- }
527
- }))
528
- } else {}
529
- } else {
530
- ff_core_List.List_each(ff_core_List.List_zip(generics1_, generics2_), ((_1) => {
531
- {
532
- const t1_ = _1.first_;
533
- const t2_ = _1.second_;
534
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
535
- return
536
- }
537
- }))
538
- }
539
- return
540
- }
541
- }
542
- }
543
- }
544
- }
545
-
546
- export function Unification_bind(self_, at_, index_, type_) {
547
- if(ff_compiler_Unification.Unification_occursIn(self_, index_, type_)) {
548
- const t_ = ff_compiler_Unification.Unification_substitute(self_, type_);
549
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Infinite type: " + ff_compiler_Syntax.Type_show(ff_compiler_Syntax.TVariable(at_, index_), ff_core_List.Link(t_, ff_core_List.Empty()))) + " = ") + ff_compiler_Syntax.Type_show(t_, ff_core_List.Empty()))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
550
- };
551
- self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, type_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
552
- ff_core_Option.Option_each(ff_core_Map.Map_get(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((map_) => {
553
- self_.constraints_ = ff_core_Map.Map_remove(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
554
- ff_core_List.List_each(ff_core_Map.Map_pairs(map_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
555
- {
556
- const name_ = _1.first_;
557
- const at2_ = _1.second_.at_;
558
- const generics_ = _1.second_.generics_;
559
- ff_compiler_Unification.Unification_constrain(self_, at2_, type_, name_, generics_)
560
- return
561
- }
562
- }))
563
- }));
564
- ff_core_Option.Option_each(ff_core_Map.Map_get(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((affected_) => {
565
- ff_core_Map.Map_remove(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
566
- ff_core_Set.Set_each(affected_, ((i_) => {
567
- ff_compiler_Unification.Unification_affect(self_, at_, type_, ff_compiler_Syntax.TVariable(at_, i_))
568
- }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
569
- }))
570
- }
571
-
572
- export function Unification_affect(self_, at_, source_, target_) {
573
- {
574
- const _1 = ff_core_Pair.Pair(ff_compiler_Unification.Unification_substitute(self_, source_), ff_compiler_Unification.Unification_substitute(self_, target_));
575
- {
576
- if(_1.first_.TVariable) {
577
- const i1_ = _1.first_.index_;
578
- if(_1.second_.TVariable) {
579
- const i2_ = _1.second_.index_;
580
- const is_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.affects_, i1_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), (() => {
581
- return ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
582
- }));
583
- self_.affects_ = ff_core_Map.Map_add(self_.affects_, i1_, ff_core_Set.Set_add(is_, i2_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
584
- return
585
- }
586
- }
587
- }
588
- {
589
- if(_1.second_.TConstructor) {
590
- if(_1.second_.name_ == "Q$") {
591
-
592
- return
593
- }
594
- }
595
- }
596
- {
597
- if(_1.first_.TConstructor) {
598
- if(_1.first_.name_ == "ff:core/Nothing.Nothing") {
599
-
600
- return
601
- }
602
- }
603
- }
604
- {
605
- const t1_ = _1.first_;
606
- const t2_ = _1.second_;
607
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
608
- return
609
- }
610
- }
611
- }
612
-
613
- export function Unification_occursIn(self_, index_, t_) {
614
- {
615
- const self_a = self_;
616
- const index_a = index_;
617
- const t_a = t_;
618
- {
619
- if(t_a.TVariable) {
620
- const i_ = t_a.index_;
621
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
622
- if(_guard1.Some) {
623
- const type_ = _guard1.value_;
624
- return ff_compiler_Unification.Unification_occursIn(self_, index_, type_)
625
- return
626
- }
627
- }
628
- }
629
- {
630
- if(t_a.TVariable) {
631
- const i_ = t_a.index_;
632
- return (i_ === index_)
633
- return
634
- }
635
- }
636
- {
637
- if(t_a.TConstructor) {
638
- const generics_ = t_a.generics_;
639
- return ff_core_List.List_any(generics_, ((t_) => {
640
- return ff_compiler_Unification.Unification_occursIn(self_, index_, t_)
641
- }))
642
- return
643
- }
644
- }
645
- }
646
- }
647
-
648
- export async function Unification_withLocalInstances$(self_, instances_, body_, $task) {
649
- const oldInstances_ = self_.instances_;
650
- self_.instances_ = ff_core_Map.Map_addAll(self_.instances_, instances_, ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
651
- try {
652
- return (await body_($task))
653
- } finally {
654
- self_.instances_ = oldInstances_
655
- }
656
- }
657
-
658
- export async function Unification_freshUnificationVariable$(self_, at_, $task) {
659
- const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
660
- self_.nextUnificationVariableIndex_ += 3;
661
- return result_
662
- }
663
-
664
- export async function Unification_instantiate$(self_, instantiation_, type_, $task) {
665
- {
666
- const self_a = self_;
667
- const instantiation_a = instantiation_;
668
- const type_a = type_;
669
- {
670
- if(type_a.TConstructor) {
671
- const at_ = type_a.at_;
672
- const name_ = type_a.name_;
673
- if(type_a.generics_.Empty) {
674
- {
675
- const _1 = ff_core_Map.Map_get(instantiation_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
676
- {
677
- if(_1.Some) {
678
- const t_ = _1.value_;
679
- return t_
680
- return
681
- }
682
- }
683
- {
684
- if(_1.None) {
685
- return type_
686
- return
687
- }
688
- }
689
- }
690
- return
691
- }
692
- }
693
- }
694
- {
695
- if(type_a.TConstructor) {
696
- const at_ = type_a.at_;
697
- const name_ = type_a.name_;
698
- const generics_ = type_a.generics_;
699
- return ff_compiler_Syntax.TConstructor(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
700
- return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
701
- })))
702
- return
703
- }
704
- }
705
- {
706
- if(type_a.TVariable) {
707
- const i_ = type_a.index_;
708
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
709
- if(_guard1.Some) {
710
- const t_ = _guard1.value_;
711
- return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, t_)
712
- return
713
- }
714
- }
715
- }
716
- {
717
- if(type_a.TVariable) {
718
- const i_ = type_a.index_;
719
- return type_
720
- return
721
- }
722
- }
723
- }
724
- }
725
-
726
- export async function Unification_instantiateConstraint$(self_, instantiation_, constraint_, $task) {
727
- {
728
- const self_a = self_;
729
- const instantiation_a = instantiation_;
730
- const constraint_a = constraint_;
731
- {
732
- const at_ = constraint_a.at_;
733
- const name_ = constraint_a.name_;
734
- const generics_ = constraint_a.generics_;
735
- return ff_compiler_Syntax.Constraint(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
736
- return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
737
- })))
738
- return
739
- }
740
- }
741
- }
742
-
743
- export async function Unification_constrain$(self_, at_, type_, constraintName_, generics_, $task) {
744
- {
745
- const _1 = type_;
746
- {
747
- if(_1.TVariable) {
748
- const i_ = _1.index_;
749
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
750
- if(_guard1.Some) {
751
- const t_ = _guard1.value_;
752
- ff_compiler_Unification.Unification_constrain(self_, at_, t_, constraintName_, generics_)
753
- return
754
- }
755
- }
756
- }
757
- {
758
- if(_1.TVariable) {
759
- const i_ = _1.index_;
760
- {
761
- const _1 = ff_core_Map.Map_get(self_.constraints_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
762
- {
763
- if(_1.None) {
764
- self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_)), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
765
- return
766
- }
767
- }
768
- {
769
- if(_1.Some) {
770
- const map_ = _1.value_;
771
- {
772
- const _1 = ff_core_Map.Map_get(map_, constraintName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
773
- {
774
- if(_1.None) {
775
- const newMap_ = ff_core_Map.Map_add(map_, constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
776
- self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, newMap_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
777
- return
778
- }
779
- }
780
- {
781
- if(_1.Some) {
782
- const generics2_ = _1.value_.generics_;
783
- ff_core_List.List_each(ff_core_List.List_zip(generics_, generics2_), ((_1) => {
784
- {
785
- const t1_ = _1.first_;
786
- const t2_ = _1.second_;
787
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
788
- return
789
- }
790
- }))
791
- return
792
- }
793
- }
794
- }
795
- return
796
- }
797
- }
798
- }
799
- return
800
- }
801
- }
802
- {
803
- if(_1.TConstructor) {
804
- const name_ = _1.name_;
805
- const generics2_ = _1.generics_;
806
- {
807
- const _1 = ff_core_Map.Map_get(self_.instances_, ff_compiler_Unification.InstanceKey(constraintName_, name_), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
808
- {
809
- if(_1.None) {
810
- const g1_ = (ff_core_List.List_isEmpty(generics_)
811
- ? ""
812
- : "[...]");
813
- const g2_ = (ff_core_List.List_isEmpty(generics2_)
814
- ? ""
815
- : "[...]");
816
- if((!self_.attemptFixes_)) {
817
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("No such instance: " + name_) + g2_) + ": ") + constraintName_) + g1_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
818
- }
819
- return
820
- }
821
- }
822
- {
823
- if(_1.Some) {
824
- const definition_ = _1.value_;
825
- const unificationVariables_ = ff_core_List.List_map(definition_.generics_, ((_) => {
826
- return ff_compiler_Unification.Unification_freshUnificationVariable(self_, at_)
827
- }));
828
- const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_.generics_, unificationVariables_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
829
- const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
830
- const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, ff_core_List.Link(type_, generics_));
831
- ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
832
- ff_core_List.List_each(definition_.constraints_, ((constraint_) => {
833
- {
834
- const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
835
- {
836
- const constraintName_ = _1.name_;
837
- const newGenerics_ = _1.generics_;
838
- ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
839
- return
840
- }
841
- }
842
- }))
843
- return
844
- }
845
- }
846
- }
847
- return
848
- }
849
- }
850
- }
851
- }
852
-
853
- export async function Unification_get$(self_, index_, $task) {
854
- return ff_core_Option.Option_map(ff_core_Map.Map_get(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((_1) => {
855
- {
856
- if(_1.TVariable) {
857
- const i_ = _1.index_;
858
- const _guard1 = ff_core_Map.Map_get(self_.substitution_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
859
- if(_guard1.Some) {
860
- const t_ = _guard1.value_;
861
- self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
862
- return t_
863
- return
864
- }
865
- }
866
- }
867
- {
868
- const t_ = _1;
869
- return t_
870
- return
871
- }
872
- }))
873
- }
874
-
875
- export async function Unification_substitute$(self_, type_, $task) {
876
- {
877
- const self_a = self_;
878
- const type_a = type_;
879
- {
880
- if(type_a.TVariable) {
881
- const i_ = type_a.index_;
882
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
883
- if(_guard1.Some) {
884
- const t_ = _guard1.value_;
885
- return ff_compiler_Unification.Unification_substitute(self_, t_)
886
- return
887
- }
888
- }
889
- }
890
- {
891
- if(type_a.TVariable) {
892
- return type_
893
- return
894
- }
895
- }
896
- {
897
- if(type_a.TConstructor) {
898
- const t_ = type_a;
899
- {
900
- const _1 = t_;
901
- {
902
- const _c = _1;
903
- return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
904
- return ff_compiler_Unification.Unification_substitute(self_, t_)
905
- })))
906
- return
907
- }
908
- }
909
- return
910
- }
911
- }
912
- }
913
- }
914
-
915
- export async function Unification_unify$(self_, at_, t1_, t2_, $task) {
916
- {
917
- const self_a = self_;
918
- const at_a = at_;
919
- const t1_a = t1_;
920
- const t2_a = t2_;
921
- {
922
- if(t1_a.TVariable) {
923
- const i1_ = t1_a.index_;
924
- if(t2_a.TVariable) {
925
- const i2_ = t2_a.index_;
926
- const _guard1 = (i1_ === i2_);
927
- if(_guard1) {
928
-
929
- return
930
- }
931
- }
932
- }
933
- }
934
- {
935
- if(t1_a.TVariable) {
936
- const i_ = t1_a.index_;
937
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
938
- if(_guard1.Some) {
939
- const t_ = _guard1.value_;
940
- ff_compiler_Unification.Unification_unify(self_, at_, t_, t2_)
941
- return
942
- }
943
- }
944
- }
945
- {
946
- if(t2_a.TVariable) {
947
- const i_ = t2_a.index_;
948
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
949
- if(_guard1.Some) {
950
- const t_ = _guard1.value_;
951
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t_)
952
- return
953
- }
954
- }
955
- }
956
- {
957
- if(t1_a.TVariable) {
958
- const i_ = t1_a.index_;
959
- ff_compiler_Unification.Unification_bind(self_, at_, i_, t2_)
960
- return
961
- }
962
- }
963
- {
964
- if(t2_a.TVariable) {
965
- const i_ = t2_a.index_;
966
- ff_compiler_Unification.Unification_bind(self_, at_, i_, t1_)
967
- return
968
- }
969
- }
970
- {
971
- if(t1_a.TConstructor) {
972
- const name1_ = t1_a.name_;
973
- const generics1_ = t1_a.generics_;
974
- if(t2_a.TConstructor) {
975
- const name2_ = t2_a.name_;
976
- const generics2_ = t2_a.generics_;
977
- if(((name1_ !== name2_) || (ff_core_List.List_size(generics1_) !== ff_core_List.List_size(generics2_)))) {
978
- if((!self_.attemptFixes_)) {
979
- const t3_ = ff_compiler_Unification.Unification_substitute(self_, t1_);
980
- const t4_ = ff_compiler_Unification.Unification_substitute(self_, t2_);
981
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Type mismatch: " + ff_compiler_Syntax.Type_show(t3_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty())))) + " vs. ") + ff_compiler_Syntax.Type_show(t4_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty()))))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
982
- } else if((ff_core_String.String_startsWith(name1_, "Function$", 0) && ff_core_String.String_startsWith(name2_, "Function$", 0))) {
983
- ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_dropLast(generics1_, 1), ff_core_List.List_dropLast(generics2_, 1)), ((_1) => {
984
- {
985
- const t3_ = _1.first_;
986
- const t4_ = _1.second_;
987
- ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
988
- return
989
- }
990
- }));
991
- ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_takeLast(generics1_, 1), ff_core_List.List_takeLast(generics2_, 1)), ((_1) => {
992
- {
993
- const t3_ = _1.first_;
994
- const t4_ = _1.second_;
995
- ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
996
- return
997
- }
998
- }))
999
- } else {}
1000
- } else {
1001
- ff_core_List.List_each(ff_core_List.List_zip(generics1_, generics2_), ((_1) => {
1002
- {
1003
- const t1_ = _1.first_;
1004
- const t2_ = _1.second_;
1005
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
1006
- return
1007
- }
1008
- }))
1009
- }
1010
- return
1011
- }
1012
- }
1013
- }
1014
- }
1015
- }
1016
-
1017
- export async function Unification_bind$(self_, at_, index_, type_, $task) {
1018
- if(ff_compiler_Unification.Unification_occursIn(self_, index_, type_)) {
1019
- const t_ = ff_compiler_Unification.Unification_substitute(self_, type_);
1020
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Infinite type: " + ff_compiler_Syntax.Type_show(ff_compiler_Syntax.TVariable(at_, index_), ff_core_List.Link(t_, ff_core_List.Empty()))) + " = ") + ff_compiler_Syntax.Type_show(t_, ff_core_List.Empty()))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1021
- };
1022
- self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, type_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1023
- ff_core_Option.Option_each(ff_core_Map.Map_get(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((map_) => {
1024
- self_.constraints_ = ff_core_Map.Map_remove(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1025
- ff_core_List.List_each(ff_core_Map.Map_pairs(map_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
1026
- {
1027
- const name_ = _1.first_;
1028
- const at2_ = _1.second_.at_;
1029
- const generics_ = _1.second_.generics_;
1030
- ff_compiler_Unification.Unification_constrain(self_, at2_, type_, name_, generics_)
1031
- return
1032
- }
1033
- }))
1034
- }));
1035
- ff_core_Option.Option_each(ff_core_Map.Map_get(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((affected_) => {
1036
- ff_core_Map.Map_remove(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1037
- ff_core_Set.Set_each(affected_, ((i_) => {
1038
- ff_compiler_Unification.Unification_affect(self_, at_, type_, ff_compiler_Syntax.TVariable(at_, i_))
1039
- }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1040
- }))
1041
- }
1042
-
1043
- export async function Unification_affect$(self_, at_, source_, target_, $task) {
1044
- {
1045
- const _1 = ff_core_Pair.Pair(ff_compiler_Unification.Unification_substitute(self_, source_), ff_compiler_Unification.Unification_substitute(self_, target_));
1046
- {
1047
- if(_1.first_.TVariable) {
1048
- const i1_ = _1.first_.index_;
1049
- if(_1.second_.TVariable) {
1050
- const i2_ = _1.second_.index_;
1051
- const is_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.affects_, i1_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), (() => {
1052
- return ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1053
- }));
1054
- self_.affects_ = ff_core_Map.Map_add(self_.affects_, i1_, ff_core_Set.Set_add(is_, i2_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1055
- return
1056
- }
1057
- }
1058
- }
1059
- {
1060
- if(_1.second_.TConstructor) {
1061
- if(_1.second_.name_ == "Q$") {
1062
-
1063
- return
1064
- }
1065
- }
1066
- }
1067
- {
1068
- if(_1.first_.TConstructor) {
1069
- if(_1.first_.name_ == "ff:core/Nothing.Nothing") {
1070
-
1071
- return
1072
- }
1073
- }
1074
- }
1075
- {
1076
- const t1_ = _1.first_;
1077
- const t2_ = _1.second_;
1078
- ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
1079
- return
1080
- }
1081
- }
1082
- }
1083
-
1084
- export async function Unification_occursIn$(self_, index_, t_, $task) {
1085
- {
1086
- const self_a = self_;
1087
- const index_a = index_;
1088
- const t_a = t_;
1089
- {
1090
- if(t_a.TVariable) {
1091
- const i_ = t_a.index_;
1092
- const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
1093
- if(_guard1.Some) {
1094
- const type_ = _guard1.value_;
1095
- return ff_compiler_Unification.Unification_occursIn(self_, index_, type_)
1096
- return
1097
- }
1098
- }
1099
- }
1100
- {
1101
- if(t_a.TVariable) {
1102
- const i_ = t_a.index_;
1103
- return (i_ === index_)
1104
- return
1105
- }
1106
- }
1107
- {
1108
- if(t_a.TConstructor) {
1109
- const generics_ = t_a.generics_;
1110
- return ff_core_List.List_any(generics_, ((t_) => {
1111
- return ff_compiler_Unification.Unification_occursIn(self_, index_, t_)
1112
- }))
1113
- return
1114
- }
1115
- }
1116
- }
1117
- }
1118
-
1119
- export const ff_core_Any_HasAnyTag$ff_compiler_Unification_ConstraintGenerics = {
1120
- anyTag_() {
1121
- return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.ConstraintGenerics" + "[") + "]"))
1122
- },
1123
- async anyTag_$($task) {
1124
- return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.ConstraintGenerics" + "[") + "]"))
1125
- }
1126
- };
1127
-
1128
- export const ff_core_Any_HasAnyTag$ff_compiler_Unification_InstanceKey = {
1129
- anyTag_() {
1130
- return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceKey" + "[") + "]"))
1131
- },
1132
- async anyTag_$($task) {
1133
- return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceKey" + "[") + "]"))
1134
- }
1135
- };
1136
-
1137
- export const ff_core_Any_HasAnyTag$ff_compiler_Unification_InstanceValue = {
1138
- anyTag_() {
1139
- return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceValue" + "[") + "]"))
1140
- },
1141
- async anyTag_$($task) {
1142
- return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceValue" + "[") + "]"))
1143
- }
1144
- };
1145
-
1146
- export const ff_core_Show_Show$ff_compiler_Unification_ConstraintGenerics = {
1147
- show_(value_) {
1148
- {
1149
- const value_a = value_;
1150
- {
1151
- const z_ = value_a;
1152
- return ((((("ConstraintGenerics" + "(") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Location.show_(z_.at_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.generics_)) + ")")
1153
- return
1154
- }
1155
- }
1156
- },
1157
- async show_$(value_, $task) {
1158
- {
1159
- const value_a = value_;
1160
- {
1161
- const z_ = value_a;
1162
- return ((((("ConstraintGenerics" + "(") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Location.show_(z_.at_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.generics_)) + ")")
1163
- return
1164
- }
1165
- }
1166
- }
1167
- };
1168
-
1169
- export const ff_core_Show_Show$ff_compiler_Unification_InstanceKey = {
1170
- show_(value_) {
1171
- {
1172
- const value_a = value_;
1173
- {
1174
- const z_ = value_a;
1175
- return ((((("InstanceKey" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.typeName_)) + ")")
1176
- return
1177
- }
1178
- }
1179
- },
1180
- async show_$(value_, $task) {
1181
- {
1182
- const value_a = value_;
1183
- {
1184
- const z_ = value_a;
1185
- return ((((("InstanceKey" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.typeName_)) + ")")
1186
- return
1187
- }
1188
- }
1189
- }
1190
- };
1191
-
1192
- export const ff_core_Show_Show$ff_compiler_Unification_InstanceValue = {
1193
- show_(value_) {
1194
- {
1195
- const value_a = value_;
1196
- {
1197
- const z_ = value_a;
1198
- return ((((((((((((("InstanceValue" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ", ") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_PackagePair.show_(z_.packagePair_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.moduleName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.typeArguments_)) + ")")
1199
- return
1200
- }
1201
- }
1202
- },
1203
- async show_$(value_, $task) {
1204
- {
1205
- const value_a = value_;
1206
- {
1207
- const z_ = value_a;
1208
- return ((((((((((((("InstanceValue" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ", ") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_PackagePair.show_(z_.packagePair_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.moduleName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.typeArguments_)) + ")")
1209
- return
1210
- }
1211
- }
1212
- }
1213
- };
1214
-
1215
- export const ff_core_Equal_Equal$ff_compiler_Unification_ConstraintGenerics = {
1216
- equals_(x_, y_) {
1217
- {
1218
- const x_a = x_;
1219
- const y_a = y_;
1220
- {
1221
- const _guard1 = (x_ === y_);
1222
- if(_guard1) {
1223
- return true
1224
- return
1225
- }
1226
- }
1227
- {
1228
- return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Location.equals_(x_.at_, y_.at_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.generics_, y_.generics_))
1229
- return
1230
- }
1231
- }
1232
- },
1233
- async equals_$(x_, y_, $task) {
1234
- {
1235
- const x_a = x_;
1236
- const y_a = y_;
1237
- {
1238
- const _guard1 = (x_ === y_);
1239
- if(_guard1) {
1240
- return true
1241
- return
1242
- }
1243
- }
1244
- {
1245
- return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Location.equals_(x_.at_, y_.at_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.generics_, y_.generics_))
1246
- return
1247
- }
1248
- }
1249
- }
1250
- };
1251
-
1252
- export const ff_core_Equal_Equal$ff_compiler_Unification_InstanceKey = {
1253
- equals_(x_, y_) {
1254
- {
1255
- const x_a = x_;
1256
- const y_a = y_;
1257
- {
1258
- const _guard1 = (x_ === y_);
1259
- if(_guard1) {
1260
- return true
1261
- return
1262
- }
1263
- }
1264
- {
1265
- return ((x_.traitName_ === y_.traitName_) && (x_.typeName_ === y_.typeName_))
1266
- return
1267
- }
1268
- }
1269
- },
1270
- async equals_$(x_, y_, $task) {
1271
- {
1272
- const x_a = x_;
1273
- const y_a = y_;
1274
- {
1275
- const _guard1 = (x_ === y_);
1276
- if(_guard1) {
1277
- return true
1278
- return
1279
- }
1280
- }
1281
- {
1282
- return ((x_.traitName_ === y_.traitName_) && (x_.typeName_ === y_.typeName_))
1283
- return
1284
- }
1285
- }
1286
- }
1287
- };
1288
-
1289
- export const ff_core_Equal_Equal$ff_compiler_Unification_InstanceValue = {
1290
- equals_(x_, y_) {
1291
- {
1292
- const x_a = x_;
1293
- const y_a = y_;
1294
- {
1295
- const _guard1 = (x_ === y_);
1296
- if(_guard1) {
1297
- return true
1298
- return
1299
- }
1300
- }
1301
- {
1302
- return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_) && (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(x_.packagePair_, y_.packagePair_) && ((x_.moduleName_ === y_.moduleName_) && ((x_.traitName_ === y_.traitName_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.typeArguments_, y_.typeArguments_))))))
1303
- return
1304
- }
1305
- }
1306
- },
1307
- async equals_$(x_, y_, $task) {
1308
- {
1309
- const x_a = x_;
1310
- const y_a = y_;
1311
- {
1312
- const _guard1 = (x_ === y_);
1313
- if(_guard1) {
1314
- return true
1315
- return
1316
- }
1317
- }
1318
- {
1319
- return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_) && (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(x_.packagePair_, y_.packagePair_) && ((x_.moduleName_ === y_.moduleName_) && ((x_.traitName_ === y_.traitName_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.typeArguments_, y_.typeArguments_))))))
1320
- return
1321
- }
1322
- }
1323
- }
1324
- };
1325
-
1326
- export const ff_core_Ordering_Order$ff_compiler_Unification_ConstraintGenerics = {
1327
- compare_(x_, y_) {
1328
- {
1329
- const x_a = x_;
1330
- const y_a = y_;
1331
- {
1332
- const _guard1 = (x_ === y_);
1333
- if(_guard1) {
1334
- return ff_core_Ordering.OrderingSame()
1335
- return
1336
- }
1337
- }
1338
- {
1339
- const atOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Location.compare_(x_.at_, y_.at_);
1340
- if((atOrdering_ !== ff_core_Ordering.OrderingSame())) {
1341
- return atOrdering_
1342
- } else {
1343
- const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.generics_, y_.generics_);
1344
- if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1345
- return genericsOrdering_
1346
- } else {
1347
- return ff_core_Ordering.OrderingSame()
1348
- }
1349
- }
1350
- return
1351
- }
1352
- }
1353
- },
1354
- async compare_$(x_, y_, $task) {
1355
- {
1356
- const x_a = x_;
1357
- const y_a = y_;
1358
- {
1359
- const _guard1 = (x_ === y_);
1360
- if(_guard1) {
1361
- return ff_core_Ordering.OrderingSame()
1362
- return
1363
- }
1364
- }
1365
- {
1366
- const atOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Location.compare_(x_.at_, y_.at_);
1367
- if((atOrdering_ !== ff_core_Ordering.OrderingSame())) {
1368
- return atOrdering_
1369
- } else {
1370
- const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.generics_, y_.generics_);
1371
- if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1372
- return genericsOrdering_
1373
- } else {
1374
- return ff_core_Ordering.OrderingSame()
1375
- }
1376
- }
1377
- return
1378
- }
1379
- }
1380
- }
1381
- };
1382
-
1383
- export const ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey = {
1384
- compare_(x_, y_) {
1385
- {
1386
- const x_a = x_;
1387
- const y_a = y_;
1388
- {
1389
- const _guard1 = (x_ === y_);
1390
- if(_guard1) {
1391
- return ff_core_Ordering.OrderingSame()
1392
- return
1393
- }
1394
- }
1395
- {
1396
- const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1397
- if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1398
- return traitNameOrdering_
1399
- } else {
1400
- const typeNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.typeName_, y_.typeName_);
1401
- if((typeNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1402
- return typeNameOrdering_
1403
- } else {
1404
- return ff_core_Ordering.OrderingSame()
1405
- }
1406
- }
1407
- return
1408
- }
1409
- }
1410
- },
1411
- async compare_$(x_, y_, $task) {
1412
- {
1413
- const x_a = x_;
1414
- const y_a = y_;
1415
- {
1416
- const _guard1 = (x_ === y_);
1417
- if(_guard1) {
1418
- return ff_core_Ordering.OrderingSame()
1419
- return
1420
- }
1421
- }
1422
- {
1423
- const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1424
- if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1425
- return traitNameOrdering_
1426
- } else {
1427
- const typeNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.typeName_, y_.typeName_);
1428
- if((typeNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1429
- return typeNameOrdering_
1430
- } else {
1431
- return ff_core_Ordering.OrderingSame()
1432
- }
1433
- }
1434
- return
1435
- }
1436
- }
1437
- }
1438
- };
1439
-
1440
- export const ff_core_Ordering_Order$ff_compiler_Unification_InstanceValue = {
1441
- compare_(x_, y_) {
1442
- {
1443
- const x_a = x_;
1444
- const y_a = y_;
1445
- {
1446
- const _guard1 = (x_ === y_);
1447
- if(_guard1) {
1448
- return ff_core_Ordering.OrderingSame()
1449
- return
1450
- }
1451
- }
1452
- {
1453
- const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
1454
- if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1455
- return genericsOrdering_
1456
- } else {
1457
- const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
1458
- if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1459
- return constraintsOrdering_
1460
- } else {
1461
- const packagePairOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair.compare_(x_.packagePair_, y_.packagePair_);
1462
- if((packagePairOrdering_ !== ff_core_Ordering.OrderingSame())) {
1463
- return packagePairOrdering_
1464
- } else {
1465
- const moduleNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.moduleName_, y_.moduleName_);
1466
- if((moduleNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1467
- return moduleNameOrdering_
1468
- } else {
1469
- const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1470
- if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1471
- return traitNameOrdering_
1472
- } else {
1473
- const typeArgumentsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.typeArguments_, y_.typeArguments_);
1474
- if((typeArgumentsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1475
- return typeArgumentsOrdering_
1476
- } else {
1477
- return ff_core_Ordering.OrderingSame()
1478
- }
1479
- }
1480
- }
1481
- }
1482
- }
1483
- }
1484
- return
1485
- }
1486
- }
1487
- },
1488
- async compare_$(x_, y_, $task) {
1489
- {
1490
- const x_a = x_;
1491
- const y_a = y_;
1492
- {
1493
- const _guard1 = (x_ === y_);
1494
- if(_guard1) {
1495
- return ff_core_Ordering.OrderingSame()
1496
- return
1497
- }
1498
- }
1499
- {
1500
- const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
1501
- if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1502
- return genericsOrdering_
1503
- } else {
1504
- const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
1505
- if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1506
- return constraintsOrdering_
1507
- } else {
1508
- const packagePairOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair.compare_(x_.packagePair_, y_.packagePair_);
1509
- if((packagePairOrdering_ !== ff_core_Ordering.OrderingSame())) {
1510
- return packagePairOrdering_
1511
- } else {
1512
- const moduleNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.moduleName_, y_.moduleName_);
1513
- if((moduleNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1514
- return moduleNameOrdering_
1515
- } else {
1516
- const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1517
- if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1518
- return traitNameOrdering_
1519
- } else {
1520
- const typeArgumentsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.typeArguments_, y_.typeArguments_);
1521
- if((typeArgumentsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1522
- return typeArgumentsOrdering_
1523
- } else {
1524
- return ff_core_Ordering.OrderingSame()
1525
- }
1526
- }
1527
- }
1528
- }
1529
- }
1530
- }
1531
- return
1532
- }
1533
- }
1534
- }
1535
- };
1536
-
1537
- export const ff_core_Serializable_Serializable$ff_compiler_Unification_ConstraintGenerics = {
1538
- serializeUsing_(serialization_, value_) {
1539
- {
1540
- const serialization_a = serialization_;
1541
- const value_a = value_;
1542
- {
1543
- const v_ = value_a;
1544
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1545
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1546
- serialization_.offset_ += 1;
1547
- ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.serializeUsing_(serialization_, v_.at_);
1548
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.generics_)
1549
- return
1550
- }
1551
- }
1552
- },
1553
- deserializeUsing_(serialization_) {
1554
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1555
- serialization_.offset_ += 1;
1556
- {
1557
- const _1 = variantIndex_;
1558
- {
1559
- if(_1 == 0) {
1560
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1561
- return ff_compiler_Unification.ConstraintGenerics(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1562
- return
1563
- }
1564
- }
1565
- {
1566
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1567
- return
1568
- }
1569
- }
1570
- },
1571
- async serializeUsing_$(serialization_, value_, $task) {
1572
- {
1573
- const serialization_a = serialization_;
1574
- const value_a = value_;
1575
- {
1576
- const v_ = value_a;
1577
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1578
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1579
- serialization_.offset_ += 1;
1580
- ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.serializeUsing_(serialization_, v_.at_);
1581
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.generics_)
1582
- return
1583
- }
1584
- }
1585
- },
1586
- async deserializeUsing_$(serialization_, $task) {
1587
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1588
- serialization_.offset_ += 1;
1589
- {
1590
- const _1 = variantIndex_;
1591
- {
1592
- if(_1 == 0) {
1593
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1594
- return ff_compiler_Unification.ConstraintGenerics(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1595
- return
1596
- }
1597
- }
1598
- {
1599
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1600
- return
1601
- }
1602
- }
1603
- }
1604
- };
1605
-
1606
- export const ff_core_Serializable_Serializable$ff_compiler_Unification_InstanceKey = {
1607
- serializeUsing_(serialization_, value_) {
1608
- {
1609
- const serialization_a = serialization_;
1610
- const value_a = value_;
1611
- {
1612
- const v_ = value_a;
1613
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1614
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1615
- serialization_.offset_ += 1;
1616
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1617
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.typeName_)
1618
- return
1619
- }
1620
- }
1621
- },
1622
- deserializeUsing_(serialization_) {
1623
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1624
- serialization_.offset_ += 1;
1625
- {
1626
- const _1 = variantIndex_;
1627
- {
1628
- if(_1 == 0) {
1629
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1630
- return ff_compiler_Unification.InstanceKey(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1631
- return
1632
- }
1633
- }
1634
- {
1635
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1636
- return
1637
- }
1638
- }
1639
- },
1640
- async serializeUsing_$(serialization_, value_, $task) {
1641
- {
1642
- const serialization_a = serialization_;
1643
- const value_a = value_;
1644
- {
1645
- const v_ = value_a;
1646
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1647
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1648
- serialization_.offset_ += 1;
1649
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1650
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.typeName_)
1651
- return
1652
- }
1653
- }
1654
- },
1655
- async deserializeUsing_$(serialization_, $task) {
1656
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1657
- serialization_.offset_ += 1;
1658
- {
1659
- const _1 = variantIndex_;
1660
- {
1661
- if(_1 == 0) {
1662
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1663
- return ff_compiler_Unification.InstanceKey(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1664
- return
1665
- }
1666
- }
1667
- {
1668
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1669
- return
1670
- }
1671
- }
1672
- }
1673
- };
1674
-
1675
- export const ff_core_Serializable_Serializable$ff_compiler_Unification_InstanceValue = {
1676
- serializeUsing_(serialization_, value_) {
1677
- {
1678
- const serialization_a = serialization_;
1679
- const value_a = value_;
1680
- {
1681
- const v_ = value_a;
1682
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1683
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1684
- serialization_.offset_ += 1;
1685
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
1686
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_);
1687
- ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.serializeUsing_(serialization_, v_.packagePair_);
1688
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.moduleName_);
1689
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1690
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.typeArguments_)
1691
- return
1692
- }
1693
- }
1694
- },
1695
- deserializeUsing_(serialization_) {
1696
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1697
- serialization_.offset_ += 1;
1698
- {
1699
- const _1 = variantIndex_;
1700
- {
1701
- if(_1 == 0) {
1702
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1703
- return ff_compiler_Unification.InstanceValue(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_), ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1704
- return
1705
- }
1706
- }
1707
- {
1708
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1709
- return
1710
- }
1711
- }
1712
- },
1713
- async serializeUsing_$(serialization_, value_, $task) {
1714
- {
1715
- const serialization_a = serialization_;
1716
- const value_a = value_;
1717
- {
1718
- const v_ = value_a;
1719
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1720
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1721
- serialization_.offset_ += 1;
1722
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
1723
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_);
1724
- ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.serializeUsing_(serialization_, v_.packagePair_);
1725
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.moduleName_);
1726
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1727
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.typeArguments_)
1728
- return
1729
- }
1730
- }
1731
- },
1732
- async deserializeUsing_$(serialization_, $task) {
1733
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1734
- serialization_.offset_ += 1;
1735
- {
1736
- const _1 = variantIndex_;
1737
- {
1738
- if(_1 == 0) {
1739
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1740
- return ff_compiler_Unification.InstanceValue(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_), ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1741
- return
1742
- }
1743
- }
1744
- {
1745
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1746
- return
1747
- }
1748
- }
1749
- }
1750
- };
1751
-
1752
-
1
+
2
+
3
+ import * as ff_compiler_Unification from "../../ff/compiler/Unification.mjs"
4
+
5
+ import * as ff_compiler_Inference from "../../ff/compiler/Inference.mjs"
6
+
7
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
8
+
9
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
10
+
11
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
12
+
13
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
14
+
15
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
16
+
17
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
18
+
19
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
20
+
21
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
22
+
23
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
24
+
25
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
26
+
27
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
28
+
29
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
30
+
31
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
32
+
33
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
34
+
35
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
36
+
37
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
38
+
39
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
40
+
41
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
42
+
43
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
44
+
45
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
46
+
47
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
48
+
49
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
50
+
51
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
52
+
53
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
54
+
55
+ import * as ff_core_List from "../../ff/core/List.mjs"
56
+
57
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
58
+
59
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
60
+
61
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
62
+
63
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
64
+
65
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
66
+
67
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
68
+
69
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
70
+
71
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
72
+
73
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
74
+
75
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
76
+
77
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
78
+
79
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
80
+
81
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
82
+
83
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
84
+
85
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
86
+
87
+ import * as ff_core_String from "../../ff/core/String.mjs"
88
+
89
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
90
+
91
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
92
+
93
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
94
+
95
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
96
+
97
+ // type Unification
98
+ export function Unification(substitution_, constraints_, nextUnificationVariableIndex_, instances_, affects_, attemptFixes_) {
99
+ return {substitution_, constraints_, nextUnificationVariableIndex_, instances_, affects_, attemptFixes_};
100
+ }
101
+
102
+ // type ConstraintGenerics
103
+ export function ConstraintGenerics(at_, generics_) {
104
+ return {at_, generics_};
105
+ }
106
+
107
+ // type InstanceKey
108
+ export function InstanceKey(traitName_, typeName_) {
109
+ return {traitName_, typeName_};
110
+ }
111
+
112
+ // type InstanceValue
113
+ export function InstanceValue(generics_, constraints_, packagePair_, moduleName_, traitName_, typeArguments_) {
114
+ return {generics_, constraints_, packagePair_, moduleName_, traitName_, typeArguments_};
115
+ }
116
+
117
+
118
+
119
+ export function fail_(at_, message_) {
120
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
121
+ }
122
+
123
+ export function make_(modules_, attemptFixes_) {
124
+ return ff_compiler_Unification.Unification(ff_core_Map.empty_(), ff_core_Map.empty_(), 3, ff_core_List.List_toMap(ff_core_List.List_flatMap(modules_, ((module_) => {
125
+ const moduleName_ = ff_core_String.String_dropLast(module_.file_, ff_core_String.String_size(".ff"));
126
+ return ff_core_List.List_map(module_.instances_, ((definition_) => {
127
+ const typeName_ = (((_1) => {
128
+ {
129
+ if(_1.TConstructor) {
130
+ const name_ = _1.name_;
131
+ return name_
132
+ return
133
+ }
134
+ }
135
+ {
136
+ if(_1.TVariable) {
137
+ const i_ = _1.index_;
138
+ return ff_compiler_Unification.fail_(definition_.at_, ("Unexpected unification variable: $" + i_))
139
+ return
140
+ }
141
+ }
142
+ }))(ff_core_List.List_grabFirst(definition_.typeArguments_));
143
+ return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(definition_.traitName_, typeName_), ff_compiler_Unification.InstanceValue(definition_.generics_, definition_.constraints_, module_.packagePair_, moduleName_, definition_.traitName_, definition_.typeArguments_))
144
+ }))
145
+ })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey), ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), attemptFixes_)
146
+ }
147
+
148
+ export async function fail_$(at_, message_, $task) {
149
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, message_), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
150
+ }
151
+
152
+ export async function make_$(modules_, attemptFixes_, $task) {
153
+ return ff_compiler_Unification.Unification(ff_core_Map.empty_(), ff_core_Map.empty_(), 3, ff_core_List.List_toMap(ff_core_List.List_flatMap(modules_, ((module_) => {
154
+ const moduleName_ = ff_core_String.String_dropLast(module_.file_, ff_core_String.String_size(".ff"));
155
+ return ff_core_List.List_map(module_.instances_, ((definition_) => {
156
+ const typeName_ = (((_1) => {
157
+ {
158
+ if(_1.TConstructor) {
159
+ const name_ = _1.name_;
160
+ return name_
161
+ return
162
+ }
163
+ }
164
+ {
165
+ if(_1.TVariable) {
166
+ const i_ = _1.index_;
167
+ return ff_compiler_Unification.fail_(definition_.at_, ("Unexpected unification variable: $" + i_))
168
+ return
169
+ }
170
+ }
171
+ }))(ff_core_List.List_grabFirst(definition_.typeArguments_));
172
+ return ff_core_Pair.Pair(ff_compiler_Unification.InstanceKey(definition_.traitName_, typeName_), ff_compiler_Unification.InstanceValue(definition_.generics_, definition_.constraints_, module_.packagePair_, moduleName_, definition_.traitName_, definition_.typeArguments_))
173
+ }))
174
+ })), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey), ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), attemptFixes_)
175
+ }
176
+
177
+ export function Unification_withLocalInstances(self_, instances_, body_) {
178
+ const oldInstances_ = self_.instances_;
179
+ self_.instances_ = ff_core_Map.Map_addAll(self_.instances_, instances_, ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
180
+ try {
181
+ return body_()
182
+ } finally {
183
+ self_.instances_ = oldInstances_
184
+ }
185
+ }
186
+
187
+ export function Unification_freshUnificationVariable(self_, at_) {
188
+ const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
189
+ self_.nextUnificationVariableIndex_ += 3;
190
+ return result_
191
+ }
192
+
193
+ export function Unification_instantiate(self_, instantiation_, type_) {
194
+ {
195
+ const self_a = self_;
196
+ const instantiation_a = instantiation_;
197
+ const type_a = type_;
198
+ {
199
+ if(type_a.TConstructor) {
200
+ const at_ = type_a.at_;
201
+ const name_ = type_a.name_;
202
+ if(type_a.generics_.Empty) {
203
+ {
204
+ const _1 = ff_core_Map.Map_get(instantiation_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
205
+ {
206
+ if(_1.Some) {
207
+ const t_ = _1.value_;
208
+ return t_
209
+ return
210
+ }
211
+ }
212
+ {
213
+ if(_1.None) {
214
+ return type_
215
+ return
216
+ }
217
+ }
218
+ }
219
+ return
220
+ }
221
+ }
222
+ }
223
+ {
224
+ if(type_a.TConstructor) {
225
+ const at_ = type_a.at_;
226
+ const name_ = type_a.name_;
227
+ const generics_ = type_a.generics_;
228
+ return ff_compiler_Syntax.TConstructor(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
229
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
230
+ })))
231
+ return
232
+ }
233
+ }
234
+ {
235
+ if(type_a.TVariable) {
236
+ const i_ = type_a.index_;
237
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
238
+ if(_guard1.Some) {
239
+ const t_ = _guard1.value_;
240
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, t_)
241
+ return
242
+ }
243
+ }
244
+ }
245
+ {
246
+ if(type_a.TVariable) {
247
+ const i_ = type_a.index_;
248
+ return type_
249
+ return
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ export function Unification_instantiateConstraint(self_, instantiation_, constraint_) {
256
+ {
257
+ const self_a = self_;
258
+ const instantiation_a = instantiation_;
259
+ const constraint_a = constraint_;
260
+ {
261
+ const at_ = constraint_a.at_;
262
+ const name_ = constraint_a.name_;
263
+ const generics_ = constraint_a.generics_;
264
+ return ff_compiler_Syntax.Constraint(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
265
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
266
+ })))
267
+ return
268
+ }
269
+ }
270
+ }
271
+
272
+ export function Unification_constrain(self_, at_, type_, constraintName_, generics_) {
273
+ {
274
+ const _1 = type_;
275
+ {
276
+ if(_1.TVariable) {
277
+ const i_ = _1.index_;
278
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
279
+ if(_guard1.Some) {
280
+ const t_ = _guard1.value_;
281
+ ff_compiler_Unification.Unification_constrain(self_, at_, t_, constraintName_, generics_)
282
+ return
283
+ }
284
+ }
285
+ }
286
+ {
287
+ if(_1.TVariable) {
288
+ const i_ = _1.index_;
289
+ {
290
+ const _1 = ff_core_Map.Map_get(self_.constraints_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
291
+ {
292
+ if(_1.None) {
293
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_)), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
294
+ return
295
+ }
296
+ }
297
+ {
298
+ if(_1.Some) {
299
+ const map_ = _1.value_;
300
+ {
301
+ const _1 = ff_core_Map.Map_get(map_, constraintName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
302
+ {
303
+ if(_1.None) {
304
+ const newMap_ = ff_core_Map.Map_add(map_, constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
305
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, newMap_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
306
+ return
307
+ }
308
+ }
309
+ {
310
+ if(_1.Some) {
311
+ const generics2_ = _1.value_.generics_;
312
+ ff_core_List.List_each(ff_core_List.List_zip(generics_, generics2_), ((_1) => {
313
+ {
314
+ const t1_ = _1.first_;
315
+ const t2_ = _1.second_;
316
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
317
+ return
318
+ }
319
+ }))
320
+ return
321
+ }
322
+ }
323
+ }
324
+ return
325
+ }
326
+ }
327
+ }
328
+ return
329
+ }
330
+ }
331
+ {
332
+ if(_1.TConstructor) {
333
+ const name_ = _1.name_;
334
+ const generics2_ = _1.generics_;
335
+ {
336
+ const _1 = ff_core_Map.Map_get(self_.instances_, ff_compiler_Unification.InstanceKey(constraintName_, name_), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
337
+ {
338
+ if(_1.None) {
339
+ const g1_ = (ff_core_List.List_isEmpty(generics_)
340
+ ? ""
341
+ : "[...]");
342
+ const g2_ = (ff_core_List.List_isEmpty(generics2_)
343
+ ? ""
344
+ : "[...]");
345
+ if((!self_.attemptFixes_)) {
346
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("No such instance: " + name_) + g2_) + ": ") + constraintName_) + g1_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
347
+ }
348
+ return
349
+ }
350
+ }
351
+ {
352
+ if(_1.Some) {
353
+ const definition_ = _1.value_;
354
+ const unificationVariables_ = ff_core_List.List_map(definition_.generics_, ((_) => {
355
+ return ff_compiler_Unification.Unification_freshUnificationVariable(self_, at_)
356
+ }));
357
+ const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_.generics_, unificationVariables_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
358
+ const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
359
+ const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, ff_core_List.Link(type_, generics_));
360
+ ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
361
+ ff_core_List.List_each(definition_.constraints_, ((constraint_) => {
362
+ {
363
+ const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
364
+ {
365
+ const constraintName_ = _1.name_;
366
+ const newGenerics_ = _1.generics_;
367
+ ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
368
+ return
369
+ }
370
+ }
371
+ }))
372
+ return
373
+ }
374
+ }
375
+ }
376
+ return
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ export function Unification_get(self_, index_) {
383
+ return ff_core_Option.Option_map(ff_core_Map.Map_get(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((_1) => {
384
+ {
385
+ if(_1.TVariable) {
386
+ const i_ = _1.index_;
387
+ const _guard1 = ff_core_Map.Map_get(self_.substitution_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
388
+ if(_guard1.Some) {
389
+ const t_ = _guard1.value_;
390
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
391
+ return t_
392
+ return
393
+ }
394
+ }
395
+ }
396
+ {
397
+ const t_ = _1;
398
+ return t_
399
+ return
400
+ }
401
+ }))
402
+ }
403
+
404
+ export function Unification_substitute(self_, type_) {
405
+ {
406
+ const self_a = self_;
407
+ const type_a = type_;
408
+ {
409
+ if(type_a.TVariable) {
410
+ const i_ = type_a.index_;
411
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
412
+ if(_guard1.Some) {
413
+ const t_ = _guard1.value_;
414
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
415
+ return
416
+ }
417
+ }
418
+ }
419
+ {
420
+ if(type_a.TVariable) {
421
+ return type_
422
+ return
423
+ }
424
+ }
425
+ {
426
+ if(type_a.TConstructor) {
427
+ const t_ = type_a;
428
+ {
429
+ const _1 = t_;
430
+ {
431
+ const _c = _1;
432
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
433
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
434
+ })))
435
+ return
436
+ }
437
+ }
438
+ return
439
+ }
440
+ }
441
+ }
442
+ }
443
+
444
+ export function Unification_unify(self_, at_, t1_, t2_) {
445
+ {
446
+ const self_a = self_;
447
+ const at_a = at_;
448
+ const t1_a = t1_;
449
+ const t2_a = t2_;
450
+ {
451
+ if(t1_a.TVariable) {
452
+ const i1_ = t1_a.index_;
453
+ if(t2_a.TVariable) {
454
+ const i2_ = t2_a.index_;
455
+ const _guard1 = (i1_ === i2_);
456
+ if(_guard1) {
457
+
458
+ return
459
+ }
460
+ }
461
+ }
462
+ }
463
+ {
464
+ if(t1_a.TVariable) {
465
+ const i_ = t1_a.index_;
466
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
467
+ if(_guard1.Some) {
468
+ const t_ = _guard1.value_;
469
+ ff_compiler_Unification.Unification_unify(self_, at_, t_, t2_)
470
+ return
471
+ }
472
+ }
473
+ }
474
+ {
475
+ if(t2_a.TVariable) {
476
+ const i_ = t2_a.index_;
477
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
478
+ if(_guard1.Some) {
479
+ const t_ = _guard1.value_;
480
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t_)
481
+ return
482
+ }
483
+ }
484
+ }
485
+ {
486
+ if(t1_a.TVariable) {
487
+ const i_ = t1_a.index_;
488
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t2_)
489
+ return
490
+ }
491
+ }
492
+ {
493
+ if(t2_a.TVariable) {
494
+ const i_ = t2_a.index_;
495
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t1_)
496
+ return
497
+ }
498
+ }
499
+ {
500
+ if(t1_a.TConstructor) {
501
+ const name1_ = t1_a.name_;
502
+ const generics1_ = t1_a.generics_;
503
+ if(t2_a.TConstructor) {
504
+ const name2_ = t2_a.name_;
505
+ const generics2_ = t2_a.generics_;
506
+ if(((name1_ !== name2_) || (ff_core_List.List_size(generics1_) !== ff_core_List.List_size(generics2_)))) {
507
+ if((!self_.attemptFixes_)) {
508
+ const t3_ = ff_compiler_Unification.Unification_substitute(self_, t1_);
509
+ const t4_ = ff_compiler_Unification.Unification_substitute(self_, t2_);
510
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Type mismatch: " + ff_compiler_Syntax.Type_show(t3_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty())))) + " vs. ") + ff_compiler_Syntax.Type_show(t4_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty()))))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
511
+ } else if((ff_core_String.String_startsWith(name1_, "Function$", 0) && ff_core_String.String_startsWith(name2_, "Function$", 0))) {
512
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_dropLast(generics1_, 1), ff_core_List.List_dropLast(generics2_, 1)), ((_1) => {
513
+ {
514
+ const t3_ = _1.first_;
515
+ const t4_ = _1.second_;
516
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
517
+ return
518
+ }
519
+ }));
520
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_takeLast(generics1_, 1), ff_core_List.List_takeLast(generics2_, 1)), ((_1) => {
521
+ {
522
+ const t3_ = _1.first_;
523
+ const t4_ = _1.second_;
524
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
525
+ return
526
+ }
527
+ }))
528
+ } else {}
529
+ } else {
530
+ ff_core_List.List_each(ff_core_List.List_zip(generics1_, generics2_), ((_1) => {
531
+ {
532
+ const t1_ = _1.first_;
533
+ const t2_ = _1.second_;
534
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
535
+ return
536
+ }
537
+ }))
538
+ }
539
+ return
540
+ }
541
+ }
542
+ }
543
+ }
544
+ }
545
+
546
+ export function Unification_bind(self_, at_, index_, type_) {
547
+ if(ff_compiler_Unification.Unification_occursIn(self_, index_, type_)) {
548
+ const t_ = ff_compiler_Unification.Unification_substitute(self_, type_);
549
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Infinite type: " + ff_compiler_Syntax.Type_show(ff_compiler_Syntax.TVariable(at_, index_), ff_core_List.Link(t_, ff_core_List.Empty()))) + " = ") + ff_compiler_Syntax.Type_show(t_, ff_core_List.Empty()))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
550
+ };
551
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, type_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
552
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((map_) => {
553
+ self_.constraints_ = ff_core_Map.Map_remove(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
554
+ ff_core_List.List_each(ff_core_Map.Map_pairs(map_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
555
+ {
556
+ const name_ = _1.first_;
557
+ const at2_ = _1.second_.at_;
558
+ const generics_ = _1.second_.generics_;
559
+ ff_compiler_Unification.Unification_constrain(self_, at2_, type_, name_, generics_)
560
+ return
561
+ }
562
+ }))
563
+ }));
564
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((affected_) => {
565
+ ff_core_Map.Map_remove(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
566
+ ff_core_Set.Set_each(affected_, ((i_) => {
567
+ ff_compiler_Unification.Unification_affect(self_, at_, type_, ff_compiler_Syntax.TVariable(at_, i_))
568
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
569
+ }))
570
+ }
571
+
572
+ export function Unification_affect(self_, at_, source_, target_) {
573
+ {
574
+ const _1 = ff_core_Pair.Pair(ff_compiler_Unification.Unification_substitute(self_, source_), ff_compiler_Unification.Unification_substitute(self_, target_));
575
+ {
576
+ if(_1.first_.TVariable) {
577
+ const i1_ = _1.first_.index_;
578
+ if(_1.second_.TVariable) {
579
+ const i2_ = _1.second_.index_;
580
+ const is_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.affects_, i1_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), (() => {
581
+ return ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
582
+ }));
583
+ self_.affects_ = ff_core_Map.Map_add(self_.affects_, i1_, ff_core_Set.Set_add(is_, i2_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
584
+ return
585
+ }
586
+ }
587
+ }
588
+ {
589
+ if(_1.second_.TConstructor) {
590
+ if(_1.second_.name_ == "Q$") {
591
+
592
+ return
593
+ }
594
+ }
595
+ }
596
+ {
597
+ if(_1.first_.TConstructor) {
598
+ if(_1.first_.name_ == "ff:core/Nothing.Nothing") {
599
+
600
+ return
601
+ }
602
+ }
603
+ }
604
+ {
605
+ const t1_ = _1.first_;
606
+ const t2_ = _1.second_;
607
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
608
+ return
609
+ }
610
+ }
611
+ }
612
+
613
+ export function Unification_occursIn(self_, index_, t_) {
614
+ {
615
+ const self_a = self_;
616
+ const index_a = index_;
617
+ const t_a = t_;
618
+ {
619
+ if(t_a.TVariable) {
620
+ const i_ = t_a.index_;
621
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
622
+ if(_guard1.Some) {
623
+ const type_ = _guard1.value_;
624
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, type_)
625
+ return
626
+ }
627
+ }
628
+ }
629
+ {
630
+ if(t_a.TVariable) {
631
+ const i_ = t_a.index_;
632
+ return (i_ === index_)
633
+ return
634
+ }
635
+ }
636
+ {
637
+ if(t_a.TConstructor) {
638
+ const generics_ = t_a.generics_;
639
+ return ff_core_List.List_any(generics_, ((t_) => {
640
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, t_)
641
+ }))
642
+ return
643
+ }
644
+ }
645
+ }
646
+ }
647
+
648
+ export async function Unification_withLocalInstances$(self_, instances_, body_, $task) {
649
+ const oldInstances_ = self_.instances_;
650
+ self_.instances_ = ff_core_Map.Map_addAll(self_.instances_, instances_, ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
651
+ try {
652
+ return (await body_($task))
653
+ } finally {
654
+ self_.instances_ = oldInstances_
655
+ }
656
+ }
657
+
658
+ export async function Unification_freshUnificationVariable$(self_, at_, $task) {
659
+ const result_ = ff_compiler_Syntax.TVariable(at_, self_.nextUnificationVariableIndex_);
660
+ self_.nextUnificationVariableIndex_ += 3;
661
+ return result_
662
+ }
663
+
664
+ export async function Unification_instantiate$(self_, instantiation_, type_, $task) {
665
+ {
666
+ const self_a = self_;
667
+ const instantiation_a = instantiation_;
668
+ const type_a = type_;
669
+ {
670
+ if(type_a.TConstructor) {
671
+ const at_ = type_a.at_;
672
+ const name_ = type_a.name_;
673
+ if(type_a.generics_.Empty) {
674
+ {
675
+ const _1 = ff_core_Map.Map_get(instantiation_, name_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
676
+ {
677
+ if(_1.Some) {
678
+ const t_ = _1.value_;
679
+ return t_
680
+ return
681
+ }
682
+ }
683
+ {
684
+ if(_1.None) {
685
+ return type_
686
+ return
687
+ }
688
+ }
689
+ }
690
+ return
691
+ }
692
+ }
693
+ }
694
+ {
695
+ if(type_a.TConstructor) {
696
+ const at_ = type_a.at_;
697
+ const name_ = type_a.name_;
698
+ const generics_ = type_a.generics_;
699
+ return ff_compiler_Syntax.TConstructor(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
700
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
701
+ })))
702
+ return
703
+ }
704
+ }
705
+ {
706
+ if(type_a.TVariable) {
707
+ const i_ = type_a.index_;
708
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
709
+ if(_guard1.Some) {
710
+ const t_ = _guard1.value_;
711
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, t_)
712
+ return
713
+ }
714
+ }
715
+ }
716
+ {
717
+ if(type_a.TVariable) {
718
+ const i_ = type_a.index_;
719
+ return type_
720
+ return
721
+ }
722
+ }
723
+ }
724
+ }
725
+
726
+ export async function Unification_instantiateConstraint$(self_, instantiation_, constraint_, $task) {
727
+ {
728
+ const self_a = self_;
729
+ const instantiation_a = instantiation_;
730
+ const constraint_a = constraint_;
731
+ {
732
+ const at_ = constraint_a.at_;
733
+ const name_ = constraint_a.name_;
734
+ const generics_ = constraint_a.generics_;
735
+ return ff_compiler_Syntax.Constraint(at_, name_, ff_core_List.List_map(generics_, ((_w1) => {
736
+ return ff_compiler_Unification.Unification_instantiate(self_, instantiation_, _w1)
737
+ })))
738
+ return
739
+ }
740
+ }
741
+ }
742
+
743
+ export async function Unification_constrain$(self_, at_, type_, constraintName_, generics_, $task) {
744
+ {
745
+ const _1 = type_;
746
+ {
747
+ if(_1.TVariable) {
748
+ const i_ = _1.index_;
749
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
750
+ if(_guard1.Some) {
751
+ const t_ = _guard1.value_;
752
+ ff_compiler_Unification.Unification_constrain(self_, at_, t_, constraintName_, generics_)
753
+ return
754
+ }
755
+ }
756
+ }
757
+ {
758
+ if(_1.TVariable) {
759
+ const i_ = _1.index_;
760
+ {
761
+ const _1 = ff_core_Map.Map_get(self_.constraints_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
762
+ {
763
+ if(_1.None) {
764
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_)), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
765
+ return
766
+ }
767
+ }
768
+ {
769
+ if(_1.Some) {
770
+ const map_ = _1.value_;
771
+ {
772
+ const _1 = ff_core_Map.Map_get(map_, constraintName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
773
+ {
774
+ if(_1.None) {
775
+ const newMap_ = ff_core_Map.Map_add(map_, constraintName_, ff_compiler_Unification.ConstraintGenerics(at_, generics_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
776
+ self_.constraints_ = ff_core_Map.Map_add(self_.constraints_, i_, newMap_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
777
+ return
778
+ }
779
+ }
780
+ {
781
+ if(_1.Some) {
782
+ const generics2_ = _1.value_.generics_;
783
+ ff_core_List.List_each(ff_core_List.List_zip(generics_, generics2_), ((_1) => {
784
+ {
785
+ const t1_ = _1.first_;
786
+ const t2_ = _1.second_;
787
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
788
+ return
789
+ }
790
+ }))
791
+ return
792
+ }
793
+ }
794
+ }
795
+ return
796
+ }
797
+ }
798
+ }
799
+ return
800
+ }
801
+ }
802
+ {
803
+ if(_1.TConstructor) {
804
+ const name_ = _1.name_;
805
+ const generics2_ = _1.generics_;
806
+ {
807
+ const _1 = ff_core_Map.Map_get(self_.instances_, ff_compiler_Unification.InstanceKey(constraintName_, name_), ff_compiler_Unification.ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey);
808
+ {
809
+ if(_1.None) {
810
+ const g1_ = (ff_core_List.List_isEmpty(generics_)
811
+ ? ""
812
+ : "[...]");
813
+ const g2_ = (ff_core_List.List_isEmpty(generics2_)
814
+ ? ""
815
+ : "[...]");
816
+ if((!self_.attemptFixes_)) {
817
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((((("No such instance: " + name_) + g2_) + ": ") + constraintName_) + g1_)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
818
+ }
819
+ return
820
+ }
821
+ }
822
+ {
823
+ if(_1.Some) {
824
+ const definition_ = _1.value_;
825
+ const unificationVariables_ = ff_core_List.List_map(definition_.generics_, ((_) => {
826
+ return ff_compiler_Unification.Unification_freshUnificationVariable(self_, at_)
827
+ }));
828
+ const instantiation_ = ff_core_List.List_toMap(ff_core_List.List_zip(definition_.generics_, unificationVariables_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
829
+ const traitType1_ = ff_compiler_Unification.Unification_instantiate(self_, instantiation_, ff_compiler_Syntax.TConstructor(at_, definition_.traitName_, definition_.typeArguments_));
830
+ const traitType2_ = ff_compiler_Syntax.TConstructor(at_, constraintName_, ff_core_List.Link(type_, generics_));
831
+ ff_compiler_Unification.Unification_unify(self_, at_, traitType1_, traitType2_);
832
+ ff_core_List.List_each(definition_.constraints_, ((constraint_) => {
833
+ {
834
+ const _1 = ff_compiler_Unification.Unification_instantiateConstraint(self_, instantiation_, constraint_);
835
+ {
836
+ const constraintName_ = _1.name_;
837
+ const newGenerics_ = _1.generics_;
838
+ ff_compiler_Unification.Unification_constrain(self_, at_, ff_core_List.List_grabFirst(newGenerics_), constraintName_, ff_core_List.List_dropFirst(newGenerics_, 1))
839
+ return
840
+ }
841
+ }
842
+ }))
843
+ return
844
+ }
845
+ }
846
+ }
847
+ return
848
+ }
849
+ }
850
+ }
851
+ }
852
+
853
+ export async function Unification_get$(self_, index_, $task) {
854
+ return ff_core_Option.Option_map(ff_core_Map.Map_get(self_.substitution_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((_1) => {
855
+ {
856
+ if(_1.TVariable) {
857
+ const i_ = _1.index_;
858
+ const _guard1 = ff_core_Map.Map_get(self_.substitution_, i_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
859
+ if(_guard1.Some) {
860
+ const t_ = _guard1.value_;
861
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, t_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
862
+ return t_
863
+ return
864
+ }
865
+ }
866
+ }
867
+ {
868
+ const t_ = _1;
869
+ return t_
870
+ return
871
+ }
872
+ }))
873
+ }
874
+
875
+ export async function Unification_substitute$(self_, type_, $task) {
876
+ {
877
+ const self_a = self_;
878
+ const type_a = type_;
879
+ {
880
+ if(type_a.TVariable) {
881
+ const i_ = type_a.index_;
882
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
883
+ if(_guard1.Some) {
884
+ const t_ = _guard1.value_;
885
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
886
+ return
887
+ }
888
+ }
889
+ }
890
+ {
891
+ if(type_a.TVariable) {
892
+ return type_
893
+ return
894
+ }
895
+ }
896
+ {
897
+ if(type_a.TConstructor) {
898
+ const t_ = type_a;
899
+ {
900
+ const _1 = t_;
901
+ {
902
+ const _c = _1;
903
+ return ff_compiler_Syntax.TConstructor(_c.at_, _c.name_, ff_core_List.List_map(t_.generics_, ((t_) => {
904
+ return ff_compiler_Unification.Unification_substitute(self_, t_)
905
+ })))
906
+ return
907
+ }
908
+ }
909
+ return
910
+ }
911
+ }
912
+ }
913
+ }
914
+
915
+ export async function Unification_unify$(self_, at_, t1_, t2_, $task) {
916
+ {
917
+ const self_a = self_;
918
+ const at_a = at_;
919
+ const t1_a = t1_;
920
+ const t2_a = t2_;
921
+ {
922
+ if(t1_a.TVariable) {
923
+ const i1_ = t1_a.index_;
924
+ if(t2_a.TVariable) {
925
+ const i2_ = t2_a.index_;
926
+ const _guard1 = (i1_ === i2_);
927
+ if(_guard1) {
928
+
929
+ return
930
+ }
931
+ }
932
+ }
933
+ }
934
+ {
935
+ if(t1_a.TVariable) {
936
+ const i_ = t1_a.index_;
937
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
938
+ if(_guard1.Some) {
939
+ const t_ = _guard1.value_;
940
+ ff_compiler_Unification.Unification_unify(self_, at_, t_, t2_)
941
+ return
942
+ }
943
+ }
944
+ }
945
+ {
946
+ if(t2_a.TVariable) {
947
+ const i_ = t2_a.index_;
948
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
949
+ if(_guard1.Some) {
950
+ const t_ = _guard1.value_;
951
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t_)
952
+ return
953
+ }
954
+ }
955
+ }
956
+ {
957
+ if(t1_a.TVariable) {
958
+ const i_ = t1_a.index_;
959
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t2_)
960
+ return
961
+ }
962
+ }
963
+ {
964
+ if(t2_a.TVariable) {
965
+ const i_ = t2_a.index_;
966
+ ff_compiler_Unification.Unification_bind(self_, at_, i_, t1_)
967
+ return
968
+ }
969
+ }
970
+ {
971
+ if(t1_a.TConstructor) {
972
+ const name1_ = t1_a.name_;
973
+ const generics1_ = t1_a.generics_;
974
+ if(t2_a.TConstructor) {
975
+ const name2_ = t2_a.name_;
976
+ const generics2_ = t2_a.generics_;
977
+ if(((name1_ !== name2_) || (ff_core_List.List_size(generics1_) !== ff_core_List.List_size(generics2_)))) {
978
+ if((!self_.attemptFixes_)) {
979
+ const t3_ = ff_compiler_Unification.Unification_substitute(self_, t1_);
980
+ const t4_ = ff_compiler_Unification.Unification_substitute(self_, t2_);
981
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Type mismatch: " + ff_compiler_Syntax.Type_show(t3_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty())))) + " vs. ") + ff_compiler_Syntax.Type_show(t4_, ff_core_List.Link(t3_, ff_core_List.Link(t4_, ff_core_List.Empty()))))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
982
+ } else if((ff_core_String.String_startsWith(name1_, "Function$", 0) && ff_core_String.String_startsWith(name2_, "Function$", 0))) {
983
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_dropLast(generics1_, 1), ff_core_List.List_dropLast(generics2_, 1)), ((_1) => {
984
+ {
985
+ const t3_ = _1.first_;
986
+ const t4_ = _1.second_;
987
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
988
+ return
989
+ }
990
+ }));
991
+ ff_core_List.List_each(ff_core_List.List_zip(ff_core_List.List_takeLast(generics1_, 1), ff_core_List.List_takeLast(generics2_, 1)), ((_1) => {
992
+ {
993
+ const t3_ = _1.first_;
994
+ const t4_ = _1.second_;
995
+ ff_compiler_Unification.Unification_unify(self_, at_, t3_, t4_)
996
+ return
997
+ }
998
+ }))
999
+ } else {}
1000
+ } else {
1001
+ ff_core_List.List_each(ff_core_List.List_zip(generics1_, generics2_), ((_1) => {
1002
+ {
1003
+ const t1_ = _1.first_;
1004
+ const t2_ = _1.second_;
1005
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
1006
+ return
1007
+ }
1008
+ }))
1009
+ }
1010
+ return
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ }
1016
+
1017
+ export async function Unification_bind$(self_, at_, index_, type_, $task) {
1018
+ if(ff_compiler_Unification.Unification_occursIn(self_, index_, type_)) {
1019
+ const t_ = ff_compiler_Unification.Unification_substitute(self_, type_);
1020
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, ((("Infinite type: " + ff_compiler_Syntax.Type_show(ff_compiler_Syntax.TVariable(at_, index_), ff_core_List.Link(t_, ff_core_List.Empty()))) + " = ") + ff_compiler_Syntax.Type_show(t_, ff_core_List.Empty()))), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
1021
+ };
1022
+ self_.substitution_ = ff_core_Map.Map_add(self_.substitution_, index_, type_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1023
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((map_) => {
1024
+ self_.constraints_ = ff_core_Map.Map_remove(self_.constraints_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1025
+ ff_core_List.List_each(ff_core_Map.Map_pairs(map_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
1026
+ {
1027
+ const name_ = _1.first_;
1028
+ const at2_ = _1.second_.at_;
1029
+ const generics_ = _1.second_.generics_;
1030
+ ff_compiler_Unification.Unification_constrain(self_, at2_, type_, name_, generics_)
1031
+ return
1032
+ }
1033
+ }))
1034
+ }));
1035
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ((affected_) => {
1036
+ ff_core_Map.Map_remove(self_.affects_, index_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int);
1037
+ ff_core_Set.Set_each(affected_, ((i_) => {
1038
+ ff_compiler_Unification.Unification_affect(self_, at_, type_, ff_compiler_Syntax.TVariable(at_, i_))
1039
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1040
+ }))
1041
+ }
1042
+
1043
+ export async function Unification_affect$(self_, at_, source_, target_, $task) {
1044
+ {
1045
+ const _1 = ff_core_Pair.Pair(ff_compiler_Unification.Unification_substitute(self_, source_), ff_compiler_Unification.Unification_substitute(self_, target_));
1046
+ {
1047
+ if(_1.first_.TVariable) {
1048
+ const i1_ = _1.first_.index_;
1049
+ if(_1.second_.TVariable) {
1050
+ const i2_ = _1.second_.index_;
1051
+ const is_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.affects_, i1_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), (() => {
1052
+ return ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1053
+ }));
1054
+ self_.affects_ = ff_core_Map.Map_add(self_.affects_, i1_, ff_core_Set.Set_add(is_, i2_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int), ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int)
1055
+ return
1056
+ }
1057
+ }
1058
+ }
1059
+ {
1060
+ if(_1.second_.TConstructor) {
1061
+ if(_1.second_.name_ == "Q$") {
1062
+
1063
+ return
1064
+ }
1065
+ }
1066
+ }
1067
+ {
1068
+ if(_1.first_.TConstructor) {
1069
+ if(_1.first_.name_ == "ff:core/Nothing.Nothing") {
1070
+
1071
+ return
1072
+ }
1073
+ }
1074
+ }
1075
+ {
1076
+ const t1_ = _1.first_;
1077
+ const t2_ = _1.second_;
1078
+ ff_compiler_Unification.Unification_unify(self_, at_, t1_, t2_)
1079
+ return
1080
+ }
1081
+ }
1082
+ }
1083
+
1084
+ export async function Unification_occursIn$(self_, index_, t_, $task) {
1085
+ {
1086
+ const self_a = self_;
1087
+ const index_a = index_;
1088
+ const t_a = t_;
1089
+ {
1090
+ if(t_a.TVariable) {
1091
+ const i_ = t_a.index_;
1092
+ const _guard1 = ff_compiler_Unification.Unification_get(self_, i_);
1093
+ if(_guard1.Some) {
1094
+ const type_ = _guard1.value_;
1095
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, type_)
1096
+ return
1097
+ }
1098
+ }
1099
+ }
1100
+ {
1101
+ if(t_a.TVariable) {
1102
+ const i_ = t_a.index_;
1103
+ return (i_ === index_)
1104
+ return
1105
+ }
1106
+ }
1107
+ {
1108
+ if(t_a.TConstructor) {
1109
+ const generics_ = t_a.generics_;
1110
+ return ff_core_List.List_any(generics_, ((t_) => {
1111
+ return ff_compiler_Unification.Unification_occursIn(self_, index_, t_)
1112
+ }))
1113
+ return
1114
+ }
1115
+ }
1116
+ }
1117
+ }
1118
+
1119
+ export const ff_core_Any_HasAnyTag$ff_compiler_Unification_ConstraintGenerics = {
1120
+ anyTag_() {
1121
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.ConstraintGenerics" + "[") + "]"))
1122
+ },
1123
+ async anyTag_$($task) {
1124
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.ConstraintGenerics" + "[") + "]"))
1125
+ }
1126
+ };
1127
+
1128
+ export const ff_core_Any_HasAnyTag$ff_compiler_Unification_InstanceKey = {
1129
+ anyTag_() {
1130
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceKey" + "[") + "]"))
1131
+ },
1132
+ async anyTag_$($task) {
1133
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceKey" + "[") + "]"))
1134
+ }
1135
+ };
1136
+
1137
+ export const ff_core_Any_HasAnyTag$ff_compiler_Unification_InstanceValue = {
1138
+ anyTag_() {
1139
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceValue" + "[") + "]"))
1140
+ },
1141
+ async anyTag_$($task) {
1142
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Unification.InstanceValue" + "[") + "]"))
1143
+ }
1144
+ };
1145
+
1146
+ export const ff_core_Show_Show$ff_compiler_Unification_ConstraintGenerics = {
1147
+ show_(value_) {
1148
+ {
1149
+ const value_a = value_;
1150
+ {
1151
+ const z_ = value_a;
1152
+ return ((((("ConstraintGenerics" + "(") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Location.show_(z_.at_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.generics_)) + ")")
1153
+ return
1154
+ }
1155
+ }
1156
+ },
1157
+ async show_$(value_, $task) {
1158
+ {
1159
+ const value_a = value_;
1160
+ {
1161
+ const z_ = value_a;
1162
+ return ((((("ConstraintGenerics" + "(") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Location.show_(z_.at_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.generics_)) + ")")
1163
+ return
1164
+ }
1165
+ }
1166
+ }
1167
+ };
1168
+
1169
+ export const ff_core_Show_Show$ff_compiler_Unification_InstanceKey = {
1170
+ show_(value_) {
1171
+ {
1172
+ const value_a = value_;
1173
+ {
1174
+ const z_ = value_a;
1175
+ return ((((("InstanceKey" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.typeName_)) + ")")
1176
+ return
1177
+ }
1178
+ }
1179
+ },
1180
+ async show_$(value_, $task) {
1181
+ {
1182
+ const value_a = value_;
1183
+ {
1184
+ const z_ = value_a;
1185
+ return ((((("InstanceKey" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.typeName_)) + ")")
1186
+ return
1187
+ }
1188
+ }
1189
+ }
1190
+ };
1191
+
1192
+ export const ff_core_Show_Show$ff_compiler_Unification_InstanceValue = {
1193
+ show_(value_) {
1194
+ {
1195
+ const value_a = value_;
1196
+ {
1197
+ const z_ = value_a;
1198
+ return ((((((((((((("InstanceValue" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ", ") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_PackagePair.show_(z_.packagePair_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.moduleName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.typeArguments_)) + ")")
1199
+ return
1200
+ }
1201
+ }
1202
+ },
1203
+ async show_$(value_, $task) {
1204
+ {
1205
+ const value_a = value_;
1206
+ {
1207
+ const z_ = value_a;
1208
+ return ((((((((((((("InstanceValue" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.generics_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Constraint).show_(z_.constraints_)) + ", ") + ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_PackagePair.show_(z_.packagePair_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.moduleName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.traitName_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_compiler_Syntax.ff_core_Show_Show$ff_compiler_Syntax_Type).show_(z_.typeArguments_)) + ")")
1209
+ return
1210
+ }
1211
+ }
1212
+ }
1213
+ };
1214
+
1215
+ export const ff_core_Equal_Equal$ff_compiler_Unification_ConstraintGenerics = {
1216
+ equals_(x_, y_) {
1217
+ {
1218
+ const x_a = x_;
1219
+ const y_a = y_;
1220
+ {
1221
+ const _guard1 = (x_ === y_);
1222
+ if(_guard1) {
1223
+ return true
1224
+ return
1225
+ }
1226
+ }
1227
+ {
1228
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Location.equals_(x_.at_, y_.at_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.generics_, y_.generics_))
1229
+ return
1230
+ }
1231
+ }
1232
+ },
1233
+ async equals_$(x_, y_, $task) {
1234
+ {
1235
+ const x_a = x_;
1236
+ const y_a = y_;
1237
+ {
1238
+ const _guard1 = (x_ === y_);
1239
+ if(_guard1) {
1240
+ return true
1241
+ return
1242
+ }
1243
+ }
1244
+ {
1245
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Location.equals_(x_.at_, y_.at_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.generics_, y_.generics_))
1246
+ return
1247
+ }
1248
+ }
1249
+ }
1250
+ };
1251
+
1252
+ export const ff_core_Equal_Equal$ff_compiler_Unification_InstanceKey = {
1253
+ equals_(x_, y_) {
1254
+ {
1255
+ const x_a = x_;
1256
+ const y_a = y_;
1257
+ {
1258
+ const _guard1 = (x_ === y_);
1259
+ if(_guard1) {
1260
+ return true
1261
+ return
1262
+ }
1263
+ }
1264
+ {
1265
+ return ((x_.traitName_ === y_.traitName_) && (x_.typeName_ === y_.typeName_))
1266
+ return
1267
+ }
1268
+ }
1269
+ },
1270
+ async equals_$(x_, y_, $task) {
1271
+ {
1272
+ const x_a = x_;
1273
+ const y_a = y_;
1274
+ {
1275
+ const _guard1 = (x_ === y_);
1276
+ if(_guard1) {
1277
+ return true
1278
+ return
1279
+ }
1280
+ }
1281
+ {
1282
+ return ((x_.traitName_ === y_.traitName_) && (x_.typeName_ === y_.typeName_))
1283
+ return
1284
+ }
1285
+ }
1286
+ }
1287
+ };
1288
+
1289
+ export const ff_core_Equal_Equal$ff_compiler_Unification_InstanceValue = {
1290
+ equals_(x_, y_) {
1291
+ {
1292
+ const x_a = x_;
1293
+ const y_a = y_;
1294
+ {
1295
+ const _guard1 = (x_ === y_);
1296
+ if(_guard1) {
1297
+ return true
1298
+ return
1299
+ }
1300
+ }
1301
+ {
1302
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_) && (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(x_.packagePair_, y_.packagePair_) && ((x_.moduleName_ === y_.moduleName_) && ((x_.traitName_ === y_.traitName_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.typeArguments_, y_.typeArguments_))))))
1303
+ return
1304
+ }
1305
+ }
1306
+ },
1307
+ async equals_$(x_, y_, $task) {
1308
+ {
1309
+ const x_a = x_;
1310
+ const y_a = y_;
1311
+ {
1312
+ const _guard1 = (x_ === y_);
1313
+ if(_guard1) {
1314
+ return true
1315
+ return
1316
+ }
1317
+ }
1318
+ {
1319
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.generics_, y_.generics_) && (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Constraint).equals_(x_.constraints_, y_.constraints_) && (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(x_.packagePair_, y_.packagePair_) && ((x_.moduleName_ === y_.moduleName_) && ((x_.traitName_ === y_.traitName_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_Type).equals_(x_.typeArguments_, y_.typeArguments_))))))
1320
+ return
1321
+ }
1322
+ }
1323
+ }
1324
+ };
1325
+
1326
+ export const ff_core_Ordering_Order$ff_compiler_Unification_ConstraintGenerics = {
1327
+ compare_(x_, y_) {
1328
+ {
1329
+ const x_a = x_;
1330
+ const y_a = y_;
1331
+ {
1332
+ const _guard1 = (x_ === y_);
1333
+ if(_guard1) {
1334
+ return ff_core_Ordering.OrderingSame()
1335
+ return
1336
+ }
1337
+ }
1338
+ {
1339
+ const atOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Location.compare_(x_.at_, y_.at_);
1340
+ if((atOrdering_ !== ff_core_Ordering.OrderingSame())) {
1341
+ return atOrdering_
1342
+ } else {
1343
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.generics_, y_.generics_);
1344
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1345
+ return genericsOrdering_
1346
+ } else {
1347
+ return ff_core_Ordering.OrderingSame()
1348
+ }
1349
+ }
1350
+ return
1351
+ }
1352
+ }
1353
+ },
1354
+ async compare_$(x_, y_, $task) {
1355
+ {
1356
+ const x_a = x_;
1357
+ const y_a = y_;
1358
+ {
1359
+ const _guard1 = (x_ === y_);
1360
+ if(_guard1) {
1361
+ return ff_core_Ordering.OrderingSame()
1362
+ return
1363
+ }
1364
+ }
1365
+ {
1366
+ const atOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Location.compare_(x_.at_, y_.at_);
1367
+ if((atOrdering_ !== ff_core_Ordering.OrderingSame())) {
1368
+ return atOrdering_
1369
+ } else {
1370
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.generics_, y_.generics_);
1371
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1372
+ return genericsOrdering_
1373
+ } else {
1374
+ return ff_core_Ordering.OrderingSame()
1375
+ }
1376
+ }
1377
+ return
1378
+ }
1379
+ }
1380
+ }
1381
+ };
1382
+
1383
+ export const ff_core_Ordering_Order$ff_compiler_Unification_InstanceKey = {
1384
+ compare_(x_, y_) {
1385
+ {
1386
+ const x_a = x_;
1387
+ const y_a = y_;
1388
+ {
1389
+ const _guard1 = (x_ === y_);
1390
+ if(_guard1) {
1391
+ return ff_core_Ordering.OrderingSame()
1392
+ return
1393
+ }
1394
+ }
1395
+ {
1396
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1397
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1398
+ return traitNameOrdering_
1399
+ } else {
1400
+ const typeNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.typeName_, y_.typeName_);
1401
+ if((typeNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1402
+ return typeNameOrdering_
1403
+ } else {
1404
+ return ff_core_Ordering.OrderingSame()
1405
+ }
1406
+ }
1407
+ return
1408
+ }
1409
+ }
1410
+ },
1411
+ async compare_$(x_, y_, $task) {
1412
+ {
1413
+ const x_a = x_;
1414
+ const y_a = y_;
1415
+ {
1416
+ const _guard1 = (x_ === y_);
1417
+ if(_guard1) {
1418
+ return ff_core_Ordering.OrderingSame()
1419
+ return
1420
+ }
1421
+ }
1422
+ {
1423
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1424
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1425
+ return traitNameOrdering_
1426
+ } else {
1427
+ const typeNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.typeName_, y_.typeName_);
1428
+ if((typeNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1429
+ return typeNameOrdering_
1430
+ } else {
1431
+ return ff_core_Ordering.OrderingSame()
1432
+ }
1433
+ }
1434
+ return
1435
+ }
1436
+ }
1437
+ }
1438
+ };
1439
+
1440
+ export const ff_core_Ordering_Order$ff_compiler_Unification_InstanceValue = {
1441
+ compare_(x_, y_) {
1442
+ {
1443
+ const x_a = x_;
1444
+ const y_a = y_;
1445
+ {
1446
+ const _guard1 = (x_ === y_);
1447
+ if(_guard1) {
1448
+ return ff_core_Ordering.OrderingSame()
1449
+ return
1450
+ }
1451
+ }
1452
+ {
1453
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
1454
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1455
+ return genericsOrdering_
1456
+ } else {
1457
+ const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
1458
+ if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1459
+ return constraintsOrdering_
1460
+ } else {
1461
+ const packagePairOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair.compare_(x_.packagePair_, y_.packagePair_);
1462
+ if((packagePairOrdering_ !== ff_core_Ordering.OrderingSame())) {
1463
+ return packagePairOrdering_
1464
+ } else {
1465
+ const moduleNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.moduleName_, y_.moduleName_);
1466
+ if((moduleNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1467
+ return moduleNameOrdering_
1468
+ } else {
1469
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1470
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1471
+ return traitNameOrdering_
1472
+ } else {
1473
+ const typeArgumentsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.typeArguments_, y_.typeArguments_);
1474
+ if((typeArgumentsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1475
+ return typeArgumentsOrdering_
1476
+ } else {
1477
+ return ff_core_Ordering.OrderingSame()
1478
+ }
1479
+ }
1480
+ }
1481
+ }
1482
+ }
1483
+ }
1484
+ return
1485
+ }
1486
+ }
1487
+ },
1488
+ async compare_$(x_, y_, $task) {
1489
+ {
1490
+ const x_a = x_;
1491
+ const y_a = y_;
1492
+ {
1493
+ const _guard1 = (x_ === y_);
1494
+ if(_guard1) {
1495
+ return ff_core_Ordering.OrderingSame()
1496
+ return
1497
+ }
1498
+ }
1499
+ {
1500
+ const genericsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.generics_, y_.generics_);
1501
+ if((genericsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1502
+ return genericsOrdering_
1503
+ } else {
1504
+ const constraintsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Constraint).compare_(x_.constraints_, y_.constraints_);
1505
+ if((constraintsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1506
+ return constraintsOrdering_
1507
+ } else {
1508
+ const packagePairOrdering_ = ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair.compare_(x_.packagePair_, y_.packagePair_);
1509
+ if((packagePairOrdering_ !== ff_core_Ordering.OrderingSame())) {
1510
+ return packagePairOrdering_
1511
+ } else {
1512
+ const moduleNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.moduleName_, y_.moduleName_);
1513
+ if((moduleNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1514
+ return moduleNameOrdering_
1515
+ } else {
1516
+ const traitNameOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.traitName_, y_.traitName_);
1517
+ if((traitNameOrdering_ !== ff_core_Ordering.OrderingSame())) {
1518
+ return traitNameOrdering_
1519
+ } else {
1520
+ const typeArgumentsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_Type).compare_(x_.typeArguments_, y_.typeArguments_);
1521
+ if((typeArgumentsOrdering_ !== ff_core_Ordering.OrderingSame())) {
1522
+ return typeArgumentsOrdering_
1523
+ } else {
1524
+ return ff_core_Ordering.OrderingSame()
1525
+ }
1526
+ }
1527
+ }
1528
+ }
1529
+ }
1530
+ }
1531
+ return
1532
+ }
1533
+ }
1534
+ }
1535
+ };
1536
+
1537
+ export const ff_core_Serializable_Serializable$ff_compiler_Unification_ConstraintGenerics = {
1538
+ serializeUsing_(serialization_, value_) {
1539
+ {
1540
+ const serialization_a = serialization_;
1541
+ const value_a = value_;
1542
+ {
1543
+ const v_ = value_a;
1544
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1545
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1546
+ serialization_.offset_ += 1;
1547
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.serializeUsing_(serialization_, v_.at_);
1548
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.generics_)
1549
+ return
1550
+ }
1551
+ }
1552
+ },
1553
+ deserializeUsing_(serialization_) {
1554
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1555
+ serialization_.offset_ += 1;
1556
+ {
1557
+ const _1 = variantIndex_;
1558
+ {
1559
+ if(_1 == 0) {
1560
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1561
+ return ff_compiler_Unification.ConstraintGenerics(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1562
+ return
1563
+ }
1564
+ }
1565
+ {
1566
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1567
+ return
1568
+ }
1569
+ }
1570
+ },
1571
+ async serializeUsing_$(serialization_, value_, $task) {
1572
+ {
1573
+ const serialization_a = serialization_;
1574
+ const value_a = value_;
1575
+ {
1576
+ const v_ = value_a;
1577
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1578
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1579
+ serialization_.offset_ += 1;
1580
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.serializeUsing_(serialization_, v_.at_);
1581
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.generics_)
1582
+ return
1583
+ }
1584
+ }
1585
+ },
1586
+ async deserializeUsing_$(serialization_, $task) {
1587
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1588
+ serialization_.offset_ += 1;
1589
+ {
1590
+ const _1 = variantIndex_;
1591
+ {
1592
+ if(_1 == 0) {
1593
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 42), 0);
1594
+ return ff_compiler_Unification.ConstraintGenerics(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Location.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1595
+ return
1596
+ }
1597
+ }
1598
+ {
1599
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1600
+ return
1601
+ }
1602
+ }
1603
+ }
1604
+ };
1605
+
1606
+ export const ff_core_Serializable_Serializable$ff_compiler_Unification_InstanceKey = {
1607
+ serializeUsing_(serialization_, value_) {
1608
+ {
1609
+ const serialization_a = serialization_;
1610
+ const value_a = value_;
1611
+ {
1612
+ const v_ = value_a;
1613
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1614
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1615
+ serialization_.offset_ += 1;
1616
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1617
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.typeName_)
1618
+ return
1619
+ }
1620
+ }
1621
+ },
1622
+ deserializeUsing_(serialization_) {
1623
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1624
+ serialization_.offset_ += 1;
1625
+ {
1626
+ const _1 = variantIndex_;
1627
+ {
1628
+ if(_1 == 0) {
1629
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1630
+ return ff_compiler_Unification.InstanceKey(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1631
+ return
1632
+ }
1633
+ }
1634
+ {
1635
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1636
+ return
1637
+ }
1638
+ }
1639
+ },
1640
+ async serializeUsing_$(serialization_, value_, $task) {
1641
+ {
1642
+ const serialization_a = serialization_;
1643
+ const value_a = value_;
1644
+ {
1645
+ const v_ = value_a;
1646
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1647
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1648
+ serialization_.offset_ += 1;
1649
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1650
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.typeName_)
1651
+ return
1652
+ }
1653
+ }
1654
+ },
1655
+ async deserializeUsing_$(serialization_, $task) {
1656
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1657
+ serialization_.offset_ += 1;
1658
+ {
1659
+ const _1 = variantIndex_;
1660
+ {
1661
+ if(_1 == 0) {
1662
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 35), 0);
1663
+ return ff_compiler_Unification.InstanceKey(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1664
+ return
1665
+ }
1666
+ }
1667
+ {
1668
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1669
+ return
1670
+ }
1671
+ }
1672
+ }
1673
+ };
1674
+
1675
+ export const ff_core_Serializable_Serializable$ff_compiler_Unification_InstanceValue = {
1676
+ serializeUsing_(serialization_, value_) {
1677
+ {
1678
+ const serialization_a = serialization_;
1679
+ const value_a = value_;
1680
+ {
1681
+ const v_ = value_a;
1682
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1683
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1684
+ serialization_.offset_ += 1;
1685
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
1686
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_);
1687
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.serializeUsing_(serialization_, v_.packagePair_);
1688
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.moduleName_);
1689
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1690
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.typeArguments_)
1691
+ return
1692
+ }
1693
+ }
1694
+ },
1695
+ deserializeUsing_(serialization_) {
1696
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1697
+ serialization_.offset_ += 1;
1698
+ {
1699
+ const _1 = variantIndex_;
1700
+ {
1701
+ if(_1 == 0) {
1702
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1703
+ return ff_compiler_Unification.InstanceValue(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_), ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1704
+ return
1705
+ }
1706
+ }
1707
+ {
1708
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1709
+ return
1710
+ }
1711
+ }
1712
+ },
1713
+ async serializeUsing_$(serialization_, value_, $task) {
1714
+ {
1715
+ const serialization_a = serialization_;
1716
+ const value_a = value_;
1717
+ {
1718
+ const v_ = value_a;
1719
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1720
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1721
+ serialization_.offset_ += 1;
1722
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.generics_);
1723
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).serializeUsing_(serialization_, v_.constraints_);
1724
+ ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.serializeUsing_(serialization_, v_.packagePair_);
1725
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.moduleName_);
1726
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.traitName_);
1727
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).serializeUsing_(serialization_, v_.typeArguments_)
1728
+ return
1729
+ }
1730
+ }
1731
+ },
1732
+ async deserializeUsing_$(serialization_, $task) {
1733
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1734
+ serialization_.offset_ += 1;
1735
+ {
1736
+ const _1 = variantIndex_;
1737
+ {
1738
+ if(_1 == 0) {
1739
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 37), 0);
1740
+ return ff_compiler_Unification.InstanceValue(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Constraint).deserializeUsing_(serialization_), ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_PackagePair.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_compiler_Syntax.ff_core_Serializable_Serializable$ff_compiler_Syntax_Type).deserializeUsing_(serialization_))
1741
+ return
1742
+ }
1743
+ }
1744
+ {
1745
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1746
+ return
1747
+ }
1748
+ }
1749
+ }
1750
+ };
1751
+
1752
+