firefly-compiler 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/.hintrc +4 -4
  2. package/README.md +1 -1
  3. package/core/HttpClient.ff +1 -1
  4. package/lsp/LanguageServer.ff +32 -7
  5. package/lsp/stderr.txt +1 -0
  6. package/lsp/stdin.txt +11 -0
  7. package/lsp/stdout.txt +41 -0
  8. package/lux/Main.ff +56 -2
  9. package/meetup/AutoCompletion.ff +6 -0
  10. package/output/js/ff/compiler/Builder.mjs +444 -444
  11. package/output/js/ff/compiler/Compiler.mjs +416 -416
  12. package/output/js/ff/compiler/Dependencies.mjs +389 -389
  13. package/output/js/ff/compiler/Deriver.mjs +1170 -1170
  14. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1309
  15. package/output/js/ff/compiler/Environment.mjs +1015 -1015
  16. package/output/js/ff/compiler/Inference.mjs +4268 -4268
  17. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5391
  18. package/output/js/ff/compiler/JsImporter.mjs +266 -266
  19. package/output/js/ff/compiler/LspHook.mjs +793 -793
  20. package/output/js/ff/compiler/Main.mjs +1675 -1675
  21. package/output/js/ff/compiler/Parser.mjs +4008 -4008
  22. package/output/js/ff/compiler/Patterns.mjs +927 -927
  23. package/output/js/ff/compiler/Resolver.mjs +2307 -2307
  24. package/output/js/ff/compiler/Substitution.mjs +1150 -1150
  25. package/output/js/ff/compiler/Syntax.mjs +12434 -12434
  26. package/output/js/ff/compiler/Token.mjs +3096 -3096
  27. package/output/js/ff/compiler/Tokenizer.mjs +593 -593
  28. package/output/js/ff/compiler/Unification.mjs +1752 -1752
  29. package/output/js/ff/compiler/Wildcards.mjs +608 -608
  30. package/output/js/ff/compiler/Workspace.mjs +687 -687
  31. package/output/js/ff/core/Any.mjs +143 -143
  32. package/output/js/ff/core/Array.mjs +547 -547
  33. package/output/js/ff/core/AssetSystem.mjs +274 -274
  34. package/output/js/ff/core/Atomic.mjs +154 -154
  35. package/output/js/ff/core/Bool.mjs +152 -152
  36. package/output/js/ff/core/Box.mjs +112 -112
  37. package/output/js/ff/core/BrowserSystem.mjs +126 -126
  38. package/output/js/ff/core/Buffer.mjs +395 -395
  39. package/output/js/ff/core/BuildSystem.mjs +296 -296
  40. package/output/js/ff/core/Channel.mjs +189 -189
  41. package/output/js/ff/core/Char.mjs +149 -149
  42. package/output/js/ff/core/Core.mjs +300 -300
  43. package/output/js/ff/core/Duration.mjs +116 -116
  44. package/output/js/ff/core/Equal.mjs +179 -179
  45. package/output/js/ff/core/Error.mjs +142 -142
  46. package/output/js/ff/core/FileHandle.mjs +150 -150
  47. package/output/js/ff/core/Float.mjs +225 -225
  48. package/output/js/ff/core/HttpClient.mjs +190 -190
  49. package/output/js/ff/core/Instant.mjs +109 -109
  50. package/output/js/ff/core/Int.mjs +265 -265
  51. package/output/js/ff/core/IntMap.mjs +280 -280
  52. package/output/js/ff/core/JsSystem.mjs +238 -238
  53. package/output/js/ff/core/JsValue.mjs +708 -708
  54. package/output/js/ff/core/List.mjs +2334 -2334
  55. package/output/js/ff/core/Lock.mjs +229 -229
  56. package/output/js/ff/core/Log.mjs +163 -163
  57. package/output/js/ff/core/Map.mjs +362 -362
  58. package/output/js/ff/core/NodeSystem.mjs +294 -294
  59. package/output/js/ff/core/Nothing.mjs +104 -104
  60. package/output/js/ff/core/Option.mjs +1015 -1015
  61. package/output/js/ff/core/Ordering.mjs +730 -730
  62. package/output/js/ff/core/Pair.mjs +331 -331
  63. package/output/js/ff/core/Path.mjs +545 -545
  64. package/output/js/ff/core/RbMap.mjs +1940 -1940
  65. package/output/js/ff/core/Serializable.mjs +428 -428
  66. package/output/js/ff/core/Set.mjs +254 -254
  67. package/output/js/ff/core/Show.mjs +205 -205
  68. package/output/js/ff/core/SourceLocation.mjs +229 -229
  69. package/output/js/ff/core/Stack.mjs +529 -529
  70. package/output/js/ff/core/Stream.mjs +1304 -1304
  71. package/output/js/ff/core/String.mjs +365 -365
  72. package/output/js/ff/core/StringMap.mjs +280 -280
  73. package/output/js/ff/core/Task.mjs +320 -320
  74. package/output/js/ff/core/Try.mjs +507 -507
  75. package/output/js/ff/core/Unit.mjs +151 -151
  76. package/package.json +29 -29
  77. package/vscode/package-lock.json +5 -5
  78. package/vscode/package.json +1 -1
@@ -1,927 +1,927 @@
1
-
2
-
3
- import * as ff_compiler_Patterns from "../../ff/compiler/Patterns.mjs"
4
-
5
- import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
6
-
7
- import * as ff_core_Any from "../../ff/core/Any.mjs"
8
-
9
- import * as ff_core_Array from "../../ff/core/Array.mjs"
10
-
11
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
12
-
13
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
14
-
15
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
16
-
17
- import * as ff_core_Box from "../../ff/core/Box.mjs"
18
-
19
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
20
-
21
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
22
-
23
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
24
-
25
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
26
-
27
- import * as ff_core_Char from "../../ff/core/Char.mjs"
28
-
29
- import * as ff_core_Core from "../../ff/core/Core.mjs"
30
-
31
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
32
-
33
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
34
-
35
- import * as ff_core_Error from "../../ff/core/Error.mjs"
36
-
37
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
38
-
39
- import * as ff_core_Float from "../../ff/core/Float.mjs"
40
-
41
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
42
-
43
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
44
-
45
- import * as ff_core_Int from "../../ff/core/Int.mjs"
46
-
47
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
48
-
49
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
50
-
51
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
52
-
53
- import * as ff_core_List from "../../ff/core/List.mjs"
54
-
55
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
56
-
57
- import * as ff_core_Log from "../../ff/core/Log.mjs"
58
-
59
- import * as ff_core_Map from "../../ff/core/Map.mjs"
60
-
61
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
62
-
63
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
64
-
65
- import * as ff_core_Option from "../../ff/core/Option.mjs"
66
-
67
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
68
-
69
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
70
-
71
- import * as ff_core_Path from "../../ff/core/Path.mjs"
72
-
73
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
-
75
- import * as ff_core_Set from "../../ff/core/Set.mjs"
76
-
77
- import * as ff_core_Show from "../../ff/core/Show.mjs"
78
-
79
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
-
81
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
-
83
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
-
85
- import * as ff_core_String from "../../ff/core/String.mjs"
86
-
87
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
88
-
89
- import * as ff_core_Task from "../../ff/core/Task.mjs"
90
-
91
- import * as ff_core_Try from "../../ff/core/Try.mjs"
92
-
93
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
94
-
95
- // type PatternInfo
96
- export function PatternInfo(variant_, otherVariants_, fields_) {
97
- return {variant_, otherVariants_, fields_};
98
- }
99
-
100
- // type PatternCaseInfo
101
- export function PatternCaseInfo(fields_, guard_) {
102
- return {fields_, guard_};
103
- }
104
-
105
-
106
-
107
- export function check_(variants_, fields_, cases_, success_, guard_) {
108
- {
109
- const _1 = ff_core_Pair.Pair(fields_, cases_);
110
- {
111
- if(_1.first_.Link) {
112
- const f_ = _1.first_.head_.first_;
113
- const p_ = _1.first_.head_.second_;
114
- const fs_ = _1.first_.tail_;
115
- const cs_ = _1.second_;
116
- const vs_ = ff_core_Option.Option_else(ff_core_Map.Map_get(variants_, f_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
117
- return ff_core_Set.Set_add(p_.otherVariants_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
118
- }));
119
- if(ff_core_Set.Set_contains(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
120
- const newFields_ = ff_core_List.List_map(p_.fields_, ((_w1) => {
121
- return ff_core_Pair.Pair_mapFirst(_w1, ((_w1) => {
122
- return ((((f_ + ".") + p_.variant_) + "_") + _w1)
123
- }))
124
- }));
125
- if((ff_core_Set.Set_size(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) === 1)) {
126
- ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_)
127
- } else {
128
- ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_List.List_toSet(ff_core_List.Link(p_.variant_, ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_);
129
- ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_Set.Set_remove(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), cs_, false, guard_)
130
- }
131
- } else {
132
- ff_compiler_Patterns.check_(variants_, ff_core_List.Empty(), cs_, false, guard_)
133
- }
134
- return
135
- }
136
- }
137
- {
138
- const _guard1 = (success_ && (!guard_));
139
- if(_guard1) {
140
-
141
- return
142
- }
143
- }
144
- {
145
- if(_1.first_.Empty) {
146
- if(_1.second_.Link) {
147
- const fs_ = _1.second_.head_.fields_;
148
- const g_ = _1.second_.head_.guard_;
149
- const cs_ = _1.second_.tail_;
150
- ff_compiler_Patterns.check_(variants_, fs_, cs_, true, g_)
151
- return
152
- }
153
- }
154
- }
155
- {
156
- if(_1.first_.Empty) {
157
- if(_1.second_.Empty) {
158
- const remaining_ = ff_core_List.List_map(ff_core_List.List_filter(ff_core_Map.Map_pairs(variants_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
159
- return (ff_core_Set.Set_size(_w1.second_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) !== 0)
160
- })), ((_1) => {
161
- {
162
- const f_ = _1.first_;
163
- const vs_ = _1.second_;
164
- return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
165
- return
166
- }
167
- }));
168
- if((ff_core_List.List_size(remaining_) !== 0)) {
169
- ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
170
- }
171
- return
172
- }
173
- }
174
- }
175
- }
176
- }
177
-
178
- export function convert_(modules_, cases_) {
179
- function unqualifiedName_(name_) {
180
- return ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
181
- return (_w1 !== 46)
182
- })))
183
- }
184
- function otherVariants_(name_) {
185
- const variantName_ = unqualifiedName_(name_);
186
- const moduleName_ = ff_core_String.String_dropLast(name_, (ff_core_String.String_size(variantName_) + 1));
187
- const variantModule_ = ff_core_Map.Map_grab(modules_, moduleName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
188
- return ff_core_Option.Option_grab(ff_core_List.List_collectFirst(variantModule_.types_, ((definition_) => {
189
- return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, ((_w1) => {
190
- return (_w1.name_ === variantName_)
191
- })), ((variant_) => {
192
- return ff_core_List.List_toSet(ff_core_List.List_filter(ff_core_List.List_map(definition_.variants_, ((_w1) => {
193
- return _w1.name_
194
- })), ((_w1) => {
195
- return (_w1 !== variantName_)
196
- })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
197
- }))
198
- })))
199
- }
200
- function convertPattern_(pattern_) {
201
- {
202
- const pattern_a = pattern_;
203
- {
204
- if(pattern_a.PString) {
205
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("String literal", ff_core_List.List_toSet(ff_core_List.Link("Any other String literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
206
- return
207
- }
208
- }
209
- {
210
- if(pattern_a.PInt) {
211
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Int literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Int literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
212
- return
213
- }
214
- }
215
- {
216
- if(pattern_a.PChar) {
217
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Char literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Char literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
218
- return
219
- }
220
- }
221
- {
222
- if(pattern_a.PVariable) {
223
- const p_ = pattern_a;
224
- return ff_core_Option.None()
225
- return
226
- }
227
- }
228
- {
229
- if(pattern_a.PVariant) {
230
- const p_ = pattern_a;
231
- const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(p_.patterns_, ((pattern_) => {
232
- return convertPattern_(pattern_)
233
- }))), ((_1) => {
234
- {
235
- const i_ = _1.first_;
236
- if(_1.second_.Some) {
237
- const p_ = _1.second_.value_;
238
- return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
239
- return
240
- }
241
- }
242
- {
243
- return ff_core_Option.None()
244
- return
245
- }
246
- }));
247
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), fields_))
248
- return
249
- }
250
- }
251
- {
252
- if(pattern_a.PVariantAs) {
253
- const p_ = pattern_a;
254
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), ff_core_List.Empty()))
255
- return
256
- }
257
- }
258
- {
259
- if(pattern_a.PAlias) {
260
- const p_ = pattern_a;
261
- return convertPattern_(p_.pattern_)
262
- return
263
- }
264
- }
265
- }
266
- }
267
- return ff_core_List.List_map(ff_core_List.List_pairs(cases_), ((_1) => {
268
- {
269
- const caseIndex_ = _1.first_;
270
- const case_ = _1.second_;
271
- const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(case_.patterns_, ((pattern_) => {
272
- return convertPattern_(pattern_)
273
- }))), ((_1) => {
274
- {
275
- const i_ = _1.first_;
276
- if(_1.second_.Some) {
277
- const p_ = _1.second_.value_;
278
- return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
279
- return
280
- }
281
- }
282
- {
283
- return ff_core_Option.None()
284
- return
285
- }
286
- }));
287
- const exhaustiveGuards_ = ff_core_List.List_all(case_.guards_, ((g_) => {
288
- const guardConverted_ = ff_compiler_Patterns.convert_(modules_, ff_core_List.Link(ff_compiler_Syntax.MatchCase(g_.at_, ff_core_List.Link(g_.pattern_, ff_core_List.Empty()), ff_core_List.Empty(), case_.body_), ff_core_List.Empty()));
289
- return ff_core_Try.Try_else(ff_core_Core.try_((() => {
290
- ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), guardConverted_, false, false);
291
- return true
292
- })), (() => {
293
- return false
294
- }))
295
- }));
296
- return ff_compiler_Patterns.PatternCaseInfo(fields_, (!exhaustiveGuards_))
297
- return
298
- }
299
- }))
300
- }
301
-
302
- export function convertAndCheck_(modules_, cases_) {
303
- const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
304
- ff_core_Try.Try_else(ff_core_Core.try_((() => {
305
- return ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), converted_, false, false)
306
- })), (() => {
307
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(cases_, 0).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
308
- }))
309
- }
310
-
311
- export function fail_(at_, message_) {
312
- return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
313
- }
314
-
315
- export async function check_$(variants_, fields_, cases_, success_, guard_, $task) {
316
- {
317
- const _1 = ff_core_Pair.Pair(fields_, cases_);
318
- {
319
- if(_1.first_.Link) {
320
- const f_ = _1.first_.head_.first_;
321
- const p_ = _1.first_.head_.second_;
322
- const fs_ = _1.first_.tail_;
323
- const cs_ = _1.second_;
324
- const vs_ = ff_core_Option.Option_else(ff_core_Map.Map_get(variants_, f_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
325
- return ff_core_Set.Set_add(p_.otherVariants_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
326
- }));
327
- if(ff_core_Set.Set_contains(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
328
- const newFields_ = ff_core_List.List_map(p_.fields_, ((_w1) => {
329
- return ff_core_Pair.Pair_mapFirst(_w1, ((_w1) => {
330
- return ((((f_ + ".") + p_.variant_) + "_") + _w1)
331
- }))
332
- }));
333
- if((ff_core_Set.Set_size(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) === 1)) {
334
- ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_)
335
- } else {
336
- ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_List.List_toSet(ff_core_List.Link(p_.variant_, ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_);
337
- ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_Set.Set_remove(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), cs_, false, guard_)
338
- }
339
- } else {
340
- ff_compiler_Patterns.check_(variants_, ff_core_List.Empty(), cs_, false, guard_)
341
- }
342
- return
343
- }
344
- }
345
- {
346
- const _guard1 = (success_ && (!guard_));
347
- if(_guard1) {
348
-
349
- return
350
- }
351
- }
352
- {
353
- if(_1.first_.Empty) {
354
- if(_1.second_.Link) {
355
- const fs_ = _1.second_.head_.fields_;
356
- const g_ = _1.second_.head_.guard_;
357
- const cs_ = _1.second_.tail_;
358
- ff_compiler_Patterns.check_(variants_, fs_, cs_, true, g_)
359
- return
360
- }
361
- }
362
- }
363
- {
364
- if(_1.first_.Empty) {
365
- if(_1.second_.Empty) {
366
- const remaining_ = ff_core_List.List_map(ff_core_List.List_filter(ff_core_Map.Map_pairs(variants_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
367
- return (ff_core_Set.Set_size(_w1.second_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) !== 0)
368
- })), ((_1) => {
369
- {
370
- const f_ = _1.first_;
371
- const vs_ = _1.second_;
372
- return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
373
- return
374
- }
375
- }));
376
- if((ff_core_List.List_size(remaining_) !== 0)) {
377
- ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
378
- }
379
- return
380
- }
381
- }
382
- }
383
- }
384
- }
385
-
386
- export async function convert_$(modules_, cases_, $task) {
387
- function unqualifiedName_(name_) {
388
- return ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
389
- return (_w1 !== 46)
390
- })))
391
- }
392
- function otherVariants_(name_) {
393
- const variantName_ = unqualifiedName_(name_);
394
- const moduleName_ = ff_core_String.String_dropLast(name_, (ff_core_String.String_size(variantName_) + 1));
395
- const variantModule_ = ff_core_Map.Map_grab(modules_, moduleName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
396
- return ff_core_Option.Option_grab(ff_core_List.List_collectFirst(variantModule_.types_, ((definition_) => {
397
- return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, ((_w1) => {
398
- return (_w1.name_ === variantName_)
399
- })), ((variant_) => {
400
- return ff_core_List.List_toSet(ff_core_List.List_filter(ff_core_List.List_map(definition_.variants_, ((_w1) => {
401
- return _w1.name_
402
- })), ((_w1) => {
403
- return (_w1 !== variantName_)
404
- })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
405
- }))
406
- })))
407
- }
408
- function convertPattern_(pattern_) {
409
- {
410
- const pattern_a = pattern_;
411
- {
412
- if(pattern_a.PString) {
413
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("String literal", ff_core_List.List_toSet(ff_core_List.Link("Any other String literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
414
- return
415
- }
416
- }
417
- {
418
- if(pattern_a.PInt) {
419
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Int literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Int literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
420
- return
421
- }
422
- }
423
- {
424
- if(pattern_a.PChar) {
425
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Char literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Char literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
426
- return
427
- }
428
- }
429
- {
430
- if(pattern_a.PVariable) {
431
- const p_ = pattern_a;
432
- return ff_core_Option.None()
433
- return
434
- }
435
- }
436
- {
437
- if(pattern_a.PVariant) {
438
- const p_ = pattern_a;
439
- const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(p_.patterns_, ((pattern_) => {
440
- return convertPattern_(pattern_)
441
- }))), ((_1) => {
442
- {
443
- const i_ = _1.first_;
444
- if(_1.second_.Some) {
445
- const p_ = _1.second_.value_;
446
- return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
447
- return
448
- }
449
- }
450
- {
451
- return ff_core_Option.None()
452
- return
453
- }
454
- }));
455
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), fields_))
456
- return
457
- }
458
- }
459
- {
460
- if(pattern_a.PVariantAs) {
461
- const p_ = pattern_a;
462
- return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), ff_core_List.Empty()))
463
- return
464
- }
465
- }
466
- {
467
- if(pattern_a.PAlias) {
468
- const p_ = pattern_a;
469
- return convertPattern_(p_.pattern_)
470
- return
471
- }
472
- }
473
- }
474
- }
475
- return ff_core_List.List_map(ff_core_List.List_pairs(cases_), ((_1) => {
476
- {
477
- const caseIndex_ = _1.first_;
478
- const case_ = _1.second_;
479
- const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(case_.patterns_, ((pattern_) => {
480
- return convertPattern_(pattern_)
481
- }))), ((_1) => {
482
- {
483
- const i_ = _1.first_;
484
- if(_1.second_.Some) {
485
- const p_ = _1.second_.value_;
486
- return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
487
- return
488
- }
489
- }
490
- {
491
- return ff_core_Option.None()
492
- return
493
- }
494
- }));
495
- const exhaustiveGuards_ = ff_core_List.List_all(case_.guards_, ((g_) => {
496
- const guardConverted_ = ff_compiler_Patterns.convert_(modules_, ff_core_List.Link(ff_compiler_Syntax.MatchCase(g_.at_, ff_core_List.Link(g_.pattern_, ff_core_List.Empty()), ff_core_List.Empty(), case_.body_), ff_core_List.Empty()));
497
- return ff_core_Try.Try_else(ff_core_Core.try_((() => {
498
- ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), guardConverted_, false, false);
499
- return true
500
- })), (() => {
501
- return false
502
- }))
503
- }));
504
- return ff_compiler_Patterns.PatternCaseInfo(fields_, (!exhaustiveGuards_))
505
- return
506
- }
507
- }))
508
- }
509
-
510
- export async function convertAndCheck_$(modules_, cases_, $task) {
511
- const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
512
- ff_core_Try.Try_else(ff_core_Core.try_((() => {
513
- return ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), converted_, false, false)
514
- })), (() => {
515
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(cases_, 0).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
516
- }))
517
- }
518
-
519
- export async function fail_$(at_, message_, $task) {
520
- return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
521
- }
522
-
523
-
524
-
525
- export const ff_core_Any_HasAnyTag$ff_compiler_Patterns_PatternInfo = {
526
- anyTag_() {
527
- return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternInfo" + "[") + "]"))
528
- },
529
- async anyTag_$($task) {
530
- return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternInfo" + "[") + "]"))
531
- }
532
- };
533
-
534
- export const ff_core_Any_HasAnyTag$ff_compiler_Patterns_PatternCaseInfo = {
535
- anyTag_() {
536
- return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternCaseInfo" + "[") + "]"))
537
- },
538
- async anyTag_$($task) {
539
- return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternCaseInfo" + "[") + "]"))
540
- }
541
- };
542
-
543
- export const ff_core_Show_Show$ff_compiler_Patterns_PatternInfo = {
544
- show_(value_) {
545
- {
546
- const value_a = value_;
547
- {
548
- const z_ = value_a;
549
- return ((((((("PatternInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variant_)) + ", ") + ff_core_Set.ff_core_Show_Show$ff_core_Set_Set(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).show_(z_.otherVariants_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ")")
550
- return
551
- }
552
- }
553
- },
554
- async show_$(value_, $task) {
555
- {
556
- const value_a = value_;
557
- {
558
- const z_ = value_a;
559
- return ((((((("PatternInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variant_)) + ", ") + ff_core_Set.ff_core_Show_Show$ff_core_Set_Set(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).show_(z_.otherVariants_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ")")
560
- return
561
- }
562
- }
563
- }
564
- };
565
-
566
- export const ff_core_Show_Show$ff_compiler_Patterns_PatternCaseInfo = {
567
- show_(value_) {
568
- {
569
- const value_a = value_;
570
- {
571
- const z_ = value_a;
572
- return ((((("PatternCaseInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.guard_)) + ")")
573
- return
574
- }
575
- }
576
- },
577
- async show_$(value_, $task) {
578
- {
579
- const value_a = value_;
580
- {
581
- const z_ = value_a;
582
- return ((((("PatternCaseInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.guard_)) + ")")
583
- return
584
- }
585
- }
586
- }
587
- };
588
-
589
- export const ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo = {
590
- equals_(x_, y_) {
591
- {
592
- const x_a = x_;
593
- const y_a = y_;
594
- {
595
- const _guard1 = (x_ === y_);
596
- if(_guard1) {
597
- return true
598
- return
599
- }
600
- }
601
- {
602
- return ((x_.variant_ === y_.variant_) && (ff_core_Set.ff_core_Equal_Equal$ff_core_Set_Set(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).equals_(x_.otherVariants_, y_.otherVariants_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_)))
603
- return
604
- }
605
- }
606
- },
607
- async equals_$(x_, y_, $task) {
608
- {
609
- const x_a = x_;
610
- const y_a = y_;
611
- {
612
- const _guard1 = (x_ === y_);
613
- if(_guard1) {
614
- return true
615
- return
616
- }
617
- }
618
- {
619
- return ((x_.variant_ === y_.variant_) && (ff_core_Set.ff_core_Equal_Equal$ff_core_Set_Set(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).equals_(x_.otherVariants_, y_.otherVariants_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_)))
620
- return
621
- }
622
- }
623
- }
624
- };
625
-
626
- export const ff_core_Equal_Equal$ff_compiler_Patterns_PatternCaseInfo = {
627
- equals_(x_, y_) {
628
- {
629
- const x_a = x_;
630
- const y_a = y_;
631
- {
632
- const _guard1 = (x_ === y_);
633
- if(_guard1) {
634
- return true
635
- return
636
- }
637
- }
638
- {
639
- return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_) && (x_.guard_ === y_.guard_))
640
- return
641
- }
642
- }
643
- },
644
- async equals_$(x_, y_, $task) {
645
- {
646
- const x_a = x_;
647
- const y_a = y_;
648
- {
649
- const _guard1 = (x_ === y_);
650
- if(_guard1) {
651
- return true
652
- return
653
- }
654
- }
655
- {
656
- return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_) && (x_.guard_ === y_.guard_))
657
- return
658
- }
659
- }
660
- }
661
- };
662
-
663
- export const ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo = {
664
- compare_(x_, y_) {
665
- {
666
- const x_a = x_;
667
- const y_a = y_;
668
- {
669
- const _guard1 = (x_ === y_);
670
- if(_guard1) {
671
- return ff_core_Ordering.OrderingSame()
672
- return
673
- }
674
- }
675
- {
676
- const variantOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variant_, y_.variant_);
677
- if((variantOrdering_ !== ff_core_Ordering.OrderingSame())) {
678
- return variantOrdering_
679
- } else {
680
- const otherVariantsOrdering_ = ff_core_Set.ff_core_Ordering_Order$ff_core_Set_Set(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.otherVariants_, y_.otherVariants_);
681
- if((otherVariantsOrdering_ !== ff_core_Ordering.OrderingSame())) {
682
- return otherVariantsOrdering_
683
- } else {
684
- const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
685
- if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
686
- return fieldsOrdering_
687
- } else {
688
- return ff_core_Ordering.OrderingSame()
689
- }
690
- }
691
- }
692
- return
693
- }
694
- }
695
- },
696
- async compare_$(x_, y_, $task) {
697
- {
698
- const x_a = x_;
699
- const y_a = y_;
700
- {
701
- const _guard1 = (x_ === y_);
702
- if(_guard1) {
703
- return ff_core_Ordering.OrderingSame()
704
- return
705
- }
706
- }
707
- {
708
- const variantOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variant_, y_.variant_);
709
- if((variantOrdering_ !== ff_core_Ordering.OrderingSame())) {
710
- return variantOrdering_
711
- } else {
712
- const otherVariantsOrdering_ = ff_core_Set.ff_core_Ordering_Order$ff_core_Set_Set(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.otherVariants_, y_.otherVariants_);
713
- if((otherVariantsOrdering_ !== ff_core_Ordering.OrderingSame())) {
714
- return otherVariantsOrdering_
715
- } else {
716
- const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
717
- if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
718
- return fieldsOrdering_
719
- } else {
720
- return ff_core_Ordering.OrderingSame()
721
- }
722
- }
723
- }
724
- return
725
- }
726
- }
727
- }
728
- };
729
-
730
- export const ff_core_Ordering_Order$ff_compiler_Patterns_PatternCaseInfo = {
731
- compare_(x_, y_) {
732
- {
733
- const x_a = x_;
734
- const y_a = y_;
735
- {
736
- const _guard1 = (x_ === y_);
737
- if(_guard1) {
738
- return ff_core_Ordering.OrderingSame()
739
- return
740
- }
741
- }
742
- {
743
- const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
744
- if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
745
- return fieldsOrdering_
746
- } else {
747
- const guardOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Bool_Bool.compare_(x_.guard_, y_.guard_);
748
- if((guardOrdering_ !== ff_core_Ordering.OrderingSame())) {
749
- return guardOrdering_
750
- } else {
751
- return ff_core_Ordering.OrderingSame()
752
- }
753
- }
754
- return
755
- }
756
- }
757
- },
758
- async compare_$(x_, y_, $task) {
759
- {
760
- const x_a = x_;
761
- const y_a = y_;
762
- {
763
- const _guard1 = (x_ === y_);
764
- if(_guard1) {
765
- return ff_core_Ordering.OrderingSame()
766
- return
767
- }
768
- }
769
- {
770
- const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
771
- if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
772
- return fieldsOrdering_
773
- } else {
774
- const guardOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Bool_Bool.compare_(x_.guard_, y_.guard_);
775
- if((guardOrdering_ !== ff_core_Ordering.OrderingSame())) {
776
- return guardOrdering_
777
- } else {
778
- return ff_core_Ordering.OrderingSame()
779
- }
780
- }
781
- return
782
- }
783
- }
784
- }
785
- };
786
-
787
- export const ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo = {
788
- serializeUsing_(serialization_, value_) {
789
- {
790
- const serialization_a = serialization_;
791
- const value_a = value_;
792
- {
793
- const v_ = value_a;
794
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
795
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
796
- serialization_.offset_ += 1;
797
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.variant_);
798
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).serializeUsing_(serialization_, v_.otherVariants_);
799
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_)
800
- return
801
- }
802
- }
803
- },
804
- deserializeUsing_(serialization_) {
805
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
806
- serialization_.offset_ += 1;
807
- {
808
- const _1 = variantIndex_;
809
- {
810
- if(_1 == 0) {
811
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
812
- return ff_compiler_Patterns.PatternInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_))
813
- return
814
- }
815
- }
816
- {
817
- 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)})
818
- return
819
- }
820
- }
821
- },
822
- async serializeUsing_$(serialization_, value_, $task) {
823
- {
824
- const serialization_a = serialization_;
825
- const value_a = value_;
826
- {
827
- const v_ = value_a;
828
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
829
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
830
- serialization_.offset_ += 1;
831
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.variant_);
832
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).serializeUsing_(serialization_, v_.otherVariants_);
833
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_)
834
- return
835
- }
836
- }
837
- },
838
- async deserializeUsing_$(serialization_, $task) {
839
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
840
- serialization_.offset_ += 1;
841
- {
842
- const _1 = variantIndex_;
843
- {
844
- if(_1 == 0) {
845
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
846
- return ff_compiler_Patterns.PatternInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_))
847
- return
848
- }
849
- }
850
- {
851
- 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)})
852
- return
853
- }
854
- }
855
- }
856
- };
857
-
858
- export const ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternCaseInfo = {
859
- serializeUsing_(serialization_, value_) {
860
- {
861
- const serialization_a = serialization_;
862
- const value_a = value_;
863
- {
864
- const v_ = value_a;
865
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
866
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
867
- serialization_.offset_ += 1;
868
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_);
869
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.serializeUsing_(serialization_, v_.guard_)
870
- return
871
- }
872
- }
873
- },
874
- deserializeUsing_(serialization_) {
875
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
876
- serialization_.offset_ += 1;
877
- {
878
- const _1 = variantIndex_;
879
- {
880
- if(_1 == 0) {
881
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
882
- return ff_compiler_Patterns.PatternCaseInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_))
883
- return
884
- }
885
- }
886
- {
887
- 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)})
888
- return
889
- }
890
- }
891
- },
892
- async serializeUsing_$(serialization_, value_, $task) {
893
- {
894
- const serialization_a = serialization_;
895
- const value_a = value_;
896
- {
897
- const v_ = value_a;
898
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
899
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
900
- serialization_.offset_ += 1;
901
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_);
902
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.serializeUsing_(serialization_, v_.guard_)
903
- return
904
- }
905
- }
906
- },
907
- async deserializeUsing_$(serialization_, $task) {
908
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
909
- serialization_.offset_ += 1;
910
- {
911
- const _1 = variantIndex_;
912
- {
913
- if(_1 == 0) {
914
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
915
- return ff_compiler_Patterns.PatternCaseInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_))
916
- return
917
- }
918
- }
919
- {
920
- 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)})
921
- return
922
- }
923
- }
924
- }
925
- };
926
-
927
-
1
+
2
+
3
+ import * as ff_compiler_Patterns from "../../ff/compiler/Patterns.mjs"
4
+
5
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
6
+
7
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
8
+
9
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
10
+
11
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
12
+
13
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
14
+
15
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
16
+
17
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
18
+
19
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
20
+
21
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
22
+
23
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
24
+
25
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
26
+
27
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
28
+
29
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
30
+
31
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
32
+
33
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
34
+
35
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
36
+
37
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
38
+
39
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
40
+
41
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
42
+
43
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
44
+
45
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
46
+
47
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
48
+
49
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
50
+
51
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
52
+
53
+ import * as ff_core_List from "../../ff/core/List.mjs"
54
+
55
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
56
+
57
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
58
+
59
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
60
+
61
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
62
+
63
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
64
+
65
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
66
+
67
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
68
+
69
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
70
+
71
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
72
+
73
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
+
75
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
76
+
77
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
+
79
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
+
81
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
82
+
83
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
84
+
85
+ import * as ff_core_String from "../../ff/core/String.mjs"
86
+
87
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
88
+
89
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
90
+
91
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
92
+
93
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
94
+
95
+ // type PatternInfo
96
+ export function PatternInfo(variant_, otherVariants_, fields_) {
97
+ return {variant_, otherVariants_, fields_};
98
+ }
99
+
100
+ // type PatternCaseInfo
101
+ export function PatternCaseInfo(fields_, guard_) {
102
+ return {fields_, guard_};
103
+ }
104
+
105
+
106
+
107
+ export function check_(variants_, fields_, cases_, success_, guard_) {
108
+ {
109
+ const _1 = ff_core_Pair.Pair(fields_, cases_);
110
+ {
111
+ if(_1.first_.Link) {
112
+ const f_ = _1.first_.head_.first_;
113
+ const p_ = _1.first_.head_.second_;
114
+ const fs_ = _1.first_.tail_;
115
+ const cs_ = _1.second_;
116
+ const vs_ = ff_core_Option.Option_else(ff_core_Map.Map_get(variants_, f_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
117
+ return ff_core_Set.Set_add(p_.otherVariants_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
118
+ }));
119
+ if(ff_core_Set.Set_contains(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
120
+ const newFields_ = ff_core_List.List_map(p_.fields_, ((_w1) => {
121
+ return ff_core_Pair.Pair_mapFirst(_w1, ((_w1) => {
122
+ return ((((f_ + ".") + p_.variant_) + "_") + _w1)
123
+ }))
124
+ }));
125
+ if((ff_core_Set.Set_size(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) === 1)) {
126
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_)
127
+ } else {
128
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_List.List_toSet(ff_core_List.Link(p_.variant_, ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_);
129
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_Set.Set_remove(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), cs_, false, guard_)
130
+ }
131
+ } else {
132
+ ff_compiler_Patterns.check_(variants_, ff_core_List.Empty(), cs_, false, guard_)
133
+ }
134
+ return
135
+ }
136
+ }
137
+ {
138
+ const _guard1 = (success_ && (!guard_));
139
+ if(_guard1) {
140
+
141
+ return
142
+ }
143
+ }
144
+ {
145
+ if(_1.first_.Empty) {
146
+ if(_1.second_.Link) {
147
+ const fs_ = _1.second_.head_.fields_;
148
+ const g_ = _1.second_.head_.guard_;
149
+ const cs_ = _1.second_.tail_;
150
+ ff_compiler_Patterns.check_(variants_, fs_, cs_, true, g_)
151
+ return
152
+ }
153
+ }
154
+ }
155
+ {
156
+ if(_1.first_.Empty) {
157
+ if(_1.second_.Empty) {
158
+ const remaining_ = ff_core_List.List_map(ff_core_List.List_filter(ff_core_Map.Map_pairs(variants_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
159
+ return (ff_core_Set.Set_size(_w1.second_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) !== 0)
160
+ })), ((_1) => {
161
+ {
162
+ const f_ = _1.first_;
163
+ const vs_ = _1.second_;
164
+ return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
165
+ return
166
+ }
167
+ }));
168
+ if((ff_core_List.List_size(remaining_) !== 0)) {
169
+ ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
170
+ }
171
+ return
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ export function convert_(modules_, cases_) {
179
+ function unqualifiedName_(name_) {
180
+ return ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
181
+ return (_w1 !== 46)
182
+ })))
183
+ }
184
+ function otherVariants_(name_) {
185
+ const variantName_ = unqualifiedName_(name_);
186
+ const moduleName_ = ff_core_String.String_dropLast(name_, (ff_core_String.String_size(variantName_) + 1));
187
+ const variantModule_ = ff_core_Map.Map_grab(modules_, moduleName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
188
+ return ff_core_Option.Option_grab(ff_core_List.List_collectFirst(variantModule_.types_, ((definition_) => {
189
+ return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, ((_w1) => {
190
+ return (_w1.name_ === variantName_)
191
+ })), ((variant_) => {
192
+ return ff_core_List.List_toSet(ff_core_List.List_filter(ff_core_List.List_map(definition_.variants_, ((_w1) => {
193
+ return _w1.name_
194
+ })), ((_w1) => {
195
+ return (_w1 !== variantName_)
196
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
197
+ }))
198
+ })))
199
+ }
200
+ function convertPattern_(pattern_) {
201
+ {
202
+ const pattern_a = pattern_;
203
+ {
204
+ if(pattern_a.PString) {
205
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("String literal", ff_core_List.List_toSet(ff_core_List.Link("Any other String literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
206
+ return
207
+ }
208
+ }
209
+ {
210
+ if(pattern_a.PInt) {
211
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Int literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Int literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
212
+ return
213
+ }
214
+ }
215
+ {
216
+ if(pattern_a.PChar) {
217
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Char literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Char literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
218
+ return
219
+ }
220
+ }
221
+ {
222
+ if(pattern_a.PVariable) {
223
+ const p_ = pattern_a;
224
+ return ff_core_Option.None()
225
+ return
226
+ }
227
+ }
228
+ {
229
+ if(pattern_a.PVariant) {
230
+ const p_ = pattern_a;
231
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(p_.patterns_, ((pattern_) => {
232
+ return convertPattern_(pattern_)
233
+ }))), ((_1) => {
234
+ {
235
+ const i_ = _1.first_;
236
+ if(_1.second_.Some) {
237
+ const p_ = _1.second_.value_;
238
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
239
+ return
240
+ }
241
+ }
242
+ {
243
+ return ff_core_Option.None()
244
+ return
245
+ }
246
+ }));
247
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), fields_))
248
+ return
249
+ }
250
+ }
251
+ {
252
+ if(pattern_a.PVariantAs) {
253
+ const p_ = pattern_a;
254
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), ff_core_List.Empty()))
255
+ return
256
+ }
257
+ }
258
+ {
259
+ if(pattern_a.PAlias) {
260
+ const p_ = pattern_a;
261
+ return convertPattern_(p_.pattern_)
262
+ return
263
+ }
264
+ }
265
+ }
266
+ }
267
+ return ff_core_List.List_map(ff_core_List.List_pairs(cases_), ((_1) => {
268
+ {
269
+ const caseIndex_ = _1.first_;
270
+ const case_ = _1.second_;
271
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(case_.patterns_, ((pattern_) => {
272
+ return convertPattern_(pattern_)
273
+ }))), ((_1) => {
274
+ {
275
+ const i_ = _1.first_;
276
+ if(_1.second_.Some) {
277
+ const p_ = _1.second_.value_;
278
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
279
+ return
280
+ }
281
+ }
282
+ {
283
+ return ff_core_Option.None()
284
+ return
285
+ }
286
+ }));
287
+ const exhaustiveGuards_ = ff_core_List.List_all(case_.guards_, ((g_) => {
288
+ const guardConverted_ = ff_compiler_Patterns.convert_(modules_, ff_core_List.Link(ff_compiler_Syntax.MatchCase(g_.at_, ff_core_List.Link(g_.pattern_, ff_core_List.Empty()), ff_core_List.Empty(), case_.body_), ff_core_List.Empty()));
289
+ return ff_core_Try.Try_else(ff_core_Core.try_((() => {
290
+ ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), guardConverted_, false, false);
291
+ return true
292
+ })), (() => {
293
+ return false
294
+ }))
295
+ }));
296
+ return ff_compiler_Patterns.PatternCaseInfo(fields_, (!exhaustiveGuards_))
297
+ return
298
+ }
299
+ }))
300
+ }
301
+
302
+ export function convertAndCheck_(modules_, cases_) {
303
+ const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
304
+ ff_core_Try.Try_else(ff_core_Core.try_((() => {
305
+ return ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), converted_, false, false)
306
+ })), (() => {
307
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(cases_, 0).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
308
+ }))
309
+ }
310
+
311
+ export function fail_(at_, message_) {
312
+ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
313
+ }
314
+
315
+ export async function check_$(variants_, fields_, cases_, success_, guard_, $task) {
316
+ {
317
+ const _1 = ff_core_Pair.Pair(fields_, cases_);
318
+ {
319
+ if(_1.first_.Link) {
320
+ const f_ = _1.first_.head_.first_;
321
+ const p_ = _1.first_.head_.second_;
322
+ const fs_ = _1.first_.tail_;
323
+ const cs_ = _1.second_;
324
+ const vs_ = ff_core_Option.Option_else(ff_core_Map.Map_get(variants_, f_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
325
+ return ff_core_Set.Set_add(p_.otherVariants_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
326
+ }));
327
+ if(ff_core_Set.Set_contains(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)) {
328
+ const newFields_ = ff_core_List.List_map(p_.fields_, ((_w1) => {
329
+ return ff_core_Pair.Pair_mapFirst(_w1, ((_w1) => {
330
+ return ((((f_ + ".") + p_.variant_) + "_") + _w1)
331
+ }))
332
+ }));
333
+ if((ff_core_Set.Set_size(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) === 1)) {
334
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_)
335
+ } else {
336
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_List.List_toSet(ff_core_List.Link(p_.variant_, ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.List_addAll(newFields_, fs_), cs_, true, guard_);
337
+ ff_compiler_Patterns.check_(ff_core_Map.Map_add(variants_, f_, ff_core_Set.Set_remove(vs_, p_.variant_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), cs_, false, guard_)
338
+ }
339
+ } else {
340
+ ff_compiler_Patterns.check_(variants_, ff_core_List.Empty(), cs_, false, guard_)
341
+ }
342
+ return
343
+ }
344
+ }
345
+ {
346
+ const _guard1 = (success_ && (!guard_));
347
+ if(_guard1) {
348
+
349
+ return
350
+ }
351
+ }
352
+ {
353
+ if(_1.first_.Empty) {
354
+ if(_1.second_.Link) {
355
+ const fs_ = _1.second_.head_.fields_;
356
+ const g_ = _1.second_.head_.guard_;
357
+ const cs_ = _1.second_.tail_;
358
+ ff_compiler_Patterns.check_(variants_, fs_, cs_, true, g_)
359
+ return
360
+ }
361
+ }
362
+ }
363
+ {
364
+ if(_1.first_.Empty) {
365
+ if(_1.second_.Empty) {
366
+ const remaining_ = ff_core_List.List_map(ff_core_List.List_filter(ff_core_Map.Map_pairs(variants_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
367
+ return (ff_core_Set.Set_size(_w1.second_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) !== 0)
368
+ })), ((_1) => {
369
+ {
370
+ const f_ = _1.first_;
371
+ const vs_ = _1.second_;
372
+ return ((f_ + " could be ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(ff_core_Set.Set_toList(vs_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
373
+ return
374
+ }
375
+ }));
376
+ if((ff_core_List.List_size(remaining_) !== 0)) {
377
+ ff_core_Core.panic_(("Unexhaustive match:\n" + ff_core_List.List_join(remaining_, "\n")))
378
+ }
379
+ return
380
+ }
381
+ }
382
+ }
383
+ }
384
+ }
385
+
386
+ export async function convert_$(modules_, cases_, $task) {
387
+ function unqualifiedName_(name_) {
388
+ return ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(name_), ((_w1) => {
389
+ return (_w1 !== 46)
390
+ })))
391
+ }
392
+ function otherVariants_(name_) {
393
+ const variantName_ = unqualifiedName_(name_);
394
+ const moduleName_ = ff_core_String.String_dropLast(name_, (ff_core_String.String_size(variantName_) + 1));
395
+ const variantModule_ = ff_core_Map.Map_grab(modules_, moduleName_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
396
+ return ff_core_Option.Option_grab(ff_core_List.List_collectFirst(variantModule_.types_, ((definition_) => {
397
+ return ff_core_Option.Option_map(ff_core_List.List_find(definition_.variants_, ((_w1) => {
398
+ return (_w1.name_ === variantName_)
399
+ })), ((variant_) => {
400
+ return ff_core_List.List_toSet(ff_core_List.List_filter(ff_core_List.List_map(definition_.variants_, ((_w1) => {
401
+ return _w1.name_
402
+ })), ((_w1) => {
403
+ return (_w1 !== variantName_)
404
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
405
+ }))
406
+ })))
407
+ }
408
+ function convertPattern_(pattern_) {
409
+ {
410
+ const pattern_a = pattern_;
411
+ {
412
+ if(pattern_a.PString) {
413
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("String literal", ff_core_List.List_toSet(ff_core_List.Link("Any other String literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
414
+ return
415
+ }
416
+ }
417
+ {
418
+ if(pattern_a.PInt) {
419
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Int literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Int literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
420
+ return
421
+ }
422
+ }
423
+ {
424
+ if(pattern_a.PChar) {
425
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo("Char literal", ff_core_List.List_toSet(ff_core_List.Link("Any other Char literal", ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty()))
426
+ return
427
+ }
428
+ }
429
+ {
430
+ if(pattern_a.PVariable) {
431
+ const p_ = pattern_a;
432
+ return ff_core_Option.None()
433
+ return
434
+ }
435
+ }
436
+ {
437
+ if(pattern_a.PVariant) {
438
+ const p_ = pattern_a;
439
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(p_.patterns_, ((pattern_) => {
440
+ return convertPattern_(pattern_)
441
+ }))), ((_1) => {
442
+ {
443
+ const i_ = _1.first_;
444
+ if(_1.second_.Some) {
445
+ const p_ = _1.second_.value_;
446
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
447
+ return
448
+ }
449
+ }
450
+ {
451
+ return ff_core_Option.None()
452
+ return
453
+ }
454
+ }));
455
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), fields_))
456
+ return
457
+ }
458
+ }
459
+ {
460
+ if(pattern_a.PVariantAs) {
461
+ const p_ = pattern_a;
462
+ return ff_core_Option.Some(ff_compiler_Patterns.PatternInfo(unqualifiedName_(p_.name_), otherVariants_(p_.name_), ff_core_List.Empty()))
463
+ return
464
+ }
465
+ }
466
+ {
467
+ if(pattern_a.PAlias) {
468
+ const p_ = pattern_a;
469
+ return convertPattern_(p_.pattern_)
470
+ return
471
+ }
472
+ }
473
+ }
474
+ }
475
+ return ff_core_List.List_map(ff_core_List.List_pairs(cases_), ((_1) => {
476
+ {
477
+ const caseIndex_ = _1.first_;
478
+ const case_ = _1.second_;
479
+ const fields_ = ff_core_List.List_collect(ff_core_List.List_pairs(ff_core_List.List_map(case_.patterns_, ((pattern_) => {
480
+ return convertPattern_(pattern_)
481
+ }))), ((_1) => {
482
+ {
483
+ const i_ = _1.first_;
484
+ if(_1.second_.Some) {
485
+ const p_ = _1.second_.value_;
486
+ return ff_core_Option.Some(ff_core_Pair.Pair(("" + i_), p_))
487
+ return
488
+ }
489
+ }
490
+ {
491
+ return ff_core_Option.None()
492
+ return
493
+ }
494
+ }));
495
+ const exhaustiveGuards_ = ff_core_List.List_all(case_.guards_, ((g_) => {
496
+ const guardConverted_ = ff_compiler_Patterns.convert_(modules_, ff_core_List.Link(ff_compiler_Syntax.MatchCase(g_.at_, ff_core_List.Link(g_.pattern_, ff_core_List.Empty()), ff_core_List.Empty(), case_.body_), ff_core_List.Empty()));
497
+ return ff_core_Try.Try_else(ff_core_Core.try_((() => {
498
+ ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), guardConverted_, false, false);
499
+ return true
500
+ })), (() => {
501
+ return false
502
+ }))
503
+ }));
504
+ return ff_compiler_Patterns.PatternCaseInfo(fields_, (!exhaustiveGuards_))
505
+ return
506
+ }
507
+ }))
508
+ }
509
+
510
+ export async function convertAndCheck_$(modules_, cases_, $task) {
511
+ const converted_ = ff_compiler_Patterns.convert_(modules_, cases_);
512
+ ff_core_Try.Try_else(ff_core_Core.try_((() => {
513
+ return ff_compiler_Patterns.check_(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_List.Empty(), converted_, false, false)
514
+ })), (() => {
515
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(ff_core_List.List_grab(cases_, 0).at_, "Unexhaustive match"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
516
+ }))
517
+ }
518
+
519
+ export async function fail_$(at_, message_, $task) {
520
+ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(at_)))
521
+ }
522
+
523
+
524
+
525
+ export const ff_core_Any_HasAnyTag$ff_compiler_Patterns_PatternInfo = {
526
+ anyTag_() {
527
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternInfo" + "[") + "]"))
528
+ },
529
+ async anyTag_$($task) {
530
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternInfo" + "[") + "]"))
531
+ }
532
+ };
533
+
534
+ export const ff_core_Any_HasAnyTag$ff_compiler_Patterns_PatternCaseInfo = {
535
+ anyTag_() {
536
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternCaseInfo" + "[") + "]"))
537
+ },
538
+ async anyTag_$($task) {
539
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Patterns.PatternCaseInfo" + "[") + "]"))
540
+ }
541
+ };
542
+
543
+ export const ff_core_Show_Show$ff_compiler_Patterns_PatternInfo = {
544
+ show_(value_) {
545
+ {
546
+ const value_a = value_;
547
+ {
548
+ const z_ = value_a;
549
+ return ((((((("PatternInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variant_)) + ", ") + ff_core_Set.ff_core_Show_Show$ff_core_Set_Set(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).show_(z_.otherVariants_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ")")
550
+ return
551
+ }
552
+ }
553
+ },
554
+ async show_$(value_, $task) {
555
+ {
556
+ const value_a = value_;
557
+ {
558
+ const z_ = value_a;
559
+ return ((((((("PatternInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.variant_)) + ", ") + ff_core_Set.ff_core_Show_Show$ff_core_Set_Set(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).show_(z_.otherVariants_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ")")
560
+ return
561
+ }
562
+ }
563
+ }
564
+ };
565
+
566
+ export const ff_core_Show_Show$ff_compiler_Patterns_PatternCaseInfo = {
567
+ show_(value_) {
568
+ {
569
+ const value_a = value_;
570
+ {
571
+ const z_ = value_a;
572
+ return ((((("PatternCaseInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.guard_)) + ")")
573
+ return
574
+ }
575
+ }
576
+ },
577
+ async show_$(value_, $task) {
578
+ {
579
+ const value_a = value_;
580
+ {
581
+ const z_ = value_a;
582
+ return ((((("PatternCaseInfo" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_Pair_Pair(ff_core_Show.ff_core_Show_Show$ff_core_String_String, ff_compiler_Patterns.ff_core_Show_Show$ff_compiler_Patterns_PatternInfo)).show_(z_.fields_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Bool_Bool.show_(z_.guard_)) + ")")
583
+ return
584
+ }
585
+ }
586
+ }
587
+ };
588
+
589
+ export const ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo = {
590
+ equals_(x_, y_) {
591
+ {
592
+ const x_a = x_;
593
+ const y_a = y_;
594
+ {
595
+ const _guard1 = (x_ === y_);
596
+ if(_guard1) {
597
+ return true
598
+ return
599
+ }
600
+ }
601
+ {
602
+ return ((x_.variant_ === y_.variant_) && (ff_core_Set.ff_core_Equal_Equal$ff_core_Set_Set(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).equals_(x_.otherVariants_, y_.otherVariants_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_)))
603
+ return
604
+ }
605
+ }
606
+ },
607
+ async equals_$(x_, y_, $task) {
608
+ {
609
+ const x_a = x_;
610
+ const y_a = y_;
611
+ {
612
+ const _guard1 = (x_ === y_);
613
+ if(_guard1) {
614
+ return true
615
+ return
616
+ }
617
+ }
618
+ {
619
+ return ((x_.variant_ === y_.variant_) && (ff_core_Set.ff_core_Equal_Equal$ff_core_Set_Set(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).equals_(x_.otherVariants_, y_.otherVariants_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_)))
620
+ return
621
+ }
622
+ }
623
+ }
624
+ };
625
+
626
+ export const ff_core_Equal_Equal$ff_compiler_Patterns_PatternCaseInfo = {
627
+ equals_(x_, y_) {
628
+ {
629
+ const x_a = x_;
630
+ const y_a = y_;
631
+ {
632
+ const _guard1 = (x_ === y_);
633
+ if(_guard1) {
634
+ return true
635
+ return
636
+ }
637
+ }
638
+ {
639
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_) && (x_.guard_ === y_.guard_))
640
+ return
641
+ }
642
+ }
643
+ },
644
+ async equals_$(x_, y_, $task) {
645
+ {
646
+ const x_a = x_;
647
+ const y_a = y_;
648
+ {
649
+ const _guard1 = (x_ === y_);
650
+ if(_guard1) {
651
+ return true
652
+ return
653
+ }
654
+ }
655
+ {
656
+ return (ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Pair.ff_core_Equal_Equal$ff_core_Pair_Pair(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String, ff_compiler_Patterns.ff_core_Equal_Equal$ff_compiler_Patterns_PatternInfo)).equals_(x_.fields_, y_.fields_) && (x_.guard_ === y_.guard_))
657
+ return
658
+ }
659
+ }
660
+ }
661
+ };
662
+
663
+ export const ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo = {
664
+ compare_(x_, y_) {
665
+ {
666
+ const x_a = x_;
667
+ const y_a = y_;
668
+ {
669
+ const _guard1 = (x_ === y_);
670
+ if(_guard1) {
671
+ return ff_core_Ordering.OrderingSame()
672
+ return
673
+ }
674
+ }
675
+ {
676
+ const variantOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variant_, y_.variant_);
677
+ if((variantOrdering_ !== ff_core_Ordering.OrderingSame())) {
678
+ return variantOrdering_
679
+ } else {
680
+ const otherVariantsOrdering_ = ff_core_Set.ff_core_Ordering_Order$ff_core_Set_Set(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.otherVariants_, y_.otherVariants_);
681
+ if((otherVariantsOrdering_ !== ff_core_Ordering.OrderingSame())) {
682
+ return otherVariantsOrdering_
683
+ } else {
684
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
685
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
686
+ return fieldsOrdering_
687
+ } else {
688
+ return ff_core_Ordering.OrderingSame()
689
+ }
690
+ }
691
+ }
692
+ return
693
+ }
694
+ }
695
+ },
696
+ async compare_$(x_, y_, $task) {
697
+ {
698
+ const x_a = x_;
699
+ const y_a = y_;
700
+ {
701
+ const _guard1 = (x_ === y_);
702
+ if(_guard1) {
703
+ return ff_core_Ordering.OrderingSame()
704
+ return
705
+ }
706
+ }
707
+ {
708
+ const variantOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.variant_, y_.variant_);
709
+ if((variantOrdering_ !== ff_core_Ordering.OrderingSame())) {
710
+ return variantOrdering_
711
+ } else {
712
+ const otherVariantsOrdering_ = ff_core_Set.ff_core_Ordering_Order$ff_core_Set_Set(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.otherVariants_, y_.otherVariants_);
713
+ if((otherVariantsOrdering_ !== ff_core_Ordering.OrderingSame())) {
714
+ return otherVariantsOrdering_
715
+ } else {
716
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
717
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
718
+ return fieldsOrdering_
719
+ } else {
720
+ return ff_core_Ordering.OrderingSame()
721
+ }
722
+ }
723
+ }
724
+ return
725
+ }
726
+ }
727
+ }
728
+ };
729
+
730
+ export const ff_core_Ordering_Order$ff_compiler_Patterns_PatternCaseInfo = {
731
+ compare_(x_, y_) {
732
+ {
733
+ const x_a = x_;
734
+ const y_a = y_;
735
+ {
736
+ const _guard1 = (x_ === y_);
737
+ if(_guard1) {
738
+ return ff_core_Ordering.OrderingSame()
739
+ return
740
+ }
741
+ }
742
+ {
743
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
744
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
745
+ return fieldsOrdering_
746
+ } else {
747
+ const guardOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Bool_Bool.compare_(x_.guard_, y_.guard_);
748
+ if((guardOrdering_ !== ff_core_Ordering.OrderingSame())) {
749
+ return guardOrdering_
750
+ } else {
751
+ return ff_core_Ordering.OrderingSame()
752
+ }
753
+ }
754
+ return
755
+ }
756
+ }
757
+ },
758
+ async compare_$(x_, y_, $task) {
759
+ {
760
+ const x_a = x_;
761
+ const y_a = y_;
762
+ {
763
+ const _guard1 = (x_ === y_);
764
+ if(_guard1) {
765
+ return ff_core_Ordering.OrderingSame()
766
+ return
767
+ }
768
+ }
769
+ {
770
+ const fieldsOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_Pair_Pair(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_compiler_Patterns.ff_core_Ordering_Order$ff_compiler_Patterns_PatternInfo)).compare_(x_.fields_, y_.fields_);
771
+ if((fieldsOrdering_ !== ff_core_Ordering.OrderingSame())) {
772
+ return fieldsOrdering_
773
+ } else {
774
+ const guardOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Bool_Bool.compare_(x_.guard_, y_.guard_);
775
+ if((guardOrdering_ !== ff_core_Ordering.OrderingSame())) {
776
+ return guardOrdering_
777
+ } else {
778
+ return ff_core_Ordering.OrderingSame()
779
+ }
780
+ }
781
+ return
782
+ }
783
+ }
784
+ }
785
+ };
786
+
787
+ export const ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo = {
788
+ serializeUsing_(serialization_, value_) {
789
+ {
790
+ const serialization_a = serialization_;
791
+ const value_a = value_;
792
+ {
793
+ const v_ = value_a;
794
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
795
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
796
+ serialization_.offset_ += 1;
797
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.variant_);
798
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).serializeUsing_(serialization_, v_.otherVariants_);
799
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_)
800
+ return
801
+ }
802
+ }
803
+ },
804
+ deserializeUsing_(serialization_) {
805
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
806
+ serialization_.offset_ += 1;
807
+ {
808
+ const _1 = variantIndex_;
809
+ {
810
+ if(_1 == 0) {
811
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
812
+ return ff_compiler_Patterns.PatternInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_))
813
+ return
814
+ }
815
+ }
816
+ {
817
+ 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)})
818
+ return
819
+ }
820
+ }
821
+ },
822
+ async serializeUsing_$(serialization_, value_, $task) {
823
+ {
824
+ const serialization_a = serialization_;
825
+ const value_a = value_;
826
+ {
827
+ const v_ = value_a;
828
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
829
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
830
+ serialization_.offset_ += 1;
831
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.variant_);
832
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).serializeUsing_(serialization_, v_.otherVariants_);
833
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_)
834
+ return
835
+ }
836
+ }
837
+ },
838
+ async deserializeUsing_$(serialization_, $task) {
839
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
840
+ serialization_.offset_ += 1;
841
+ {
842
+ const _1 = variantIndex_;
843
+ {
844
+ if(_1 == 0) {
845
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 32), 0);
846
+ return ff_compiler_Patterns.PatternInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Set_Set(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_))
847
+ return
848
+ }
849
+ }
850
+ {
851
+ 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)})
852
+ return
853
+ }
854
+ }
855
+ }
856
+ };
857
+
858
+ export const ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternCaseInfo = {
859
+ serializeUsing_(serialization_, value_) {
860
+ {
861
+ const serialization_a = serialization_;
862
+ const value_a = value_;
863
+ {
864
+ const v_ = value_a;
865
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
866
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
867
+ serialization_.offset_ += 1;
868
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_);
869
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.serializeUsing_(serialization_, v_.guard_)
870
+ return
871
+ }
872
+ }
873
+ },
874
+ deserializeUsing_(serialization_) {
875
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
876
+ serialization_.offset_ += 1;
877
+ {
878
+ const _1 = variantIndex_;
879
+ {
880
+ if(_1 == 0) {
881
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
882
+ return ff_compiler_Patterns.PatternCaseInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_))
883
+ return
884
+ }
885
+ }
886
+ {
887
+ 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)})
888
+ return
889
+ }
890
+ }
891
+ },
892
+ async serializeUsing_$(serialization_, value_, $task) {
893
+ {
894
+ const serialization_a = serialization_;
895
+ const value_a = value_;
896
+ {
897
+ const v_ = value_a;
898
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
899
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
900
+ serialization_.offset_ += 1;
901
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).serializeUsing_(serialization_, v_.fields_);
902
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.serializeUsing_(serialization_, v_.guard_)
903
+ return
904
+ }
905
+ }
906
+ },
907
+ async deserializeUsing_$(serialization_, $task) {
908
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
909
+ serialization_.offset_ += 1;
910
+ {
911
+ const _1 = variantIndex_;
912
+ {
913
+ if(_1 == 0) {
914
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 36), 0);
915
+ return ff_compiler_Patterns.PatternCaseInfo(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Pair.ff_core_Serializable_Serializable$ff_core_Pair_Pair(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String, ff_compiler_Patterns.ff_core_Serializable_Serializable$ff_compiler_Patterns_PatternInfo)).deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Bool_Bool.deserializeUsing_(serialization_))
916
+ return
917
+ }
918
+ }
919
+ {
920
+ 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)})
921
+ return
922
+ }
923
+ }
924
+ }
925
+ };
926
+
927
+