firefly-compiler 0.4.6 → 0.4.8

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