firefly-compiler 0.4.4 → 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 (98) hide show
  1. package/.hintrc +5 -0
  2. package/README.md +42 -61
  3. package/compiler/Compiler.ff +6 -2
  4. package/compiler/Deriver.ff +10 -0
  5. package/compiler/Environment.ff +2 -1
  6. package/compiler/JsEmitter.ff +29 -17
  7. package/compiler/Resolver.ff +1 -1
  8. package/core/.firefly/package.ff +1 -2
  9. package/core/Box.ff +7 -0
  10. package/core/BuildSystem.ff +5 -4
  11. package/core/Core.ff +4 -0
  12. package/core/HttpClient.ff +1 -1
  13. package/core/JsValue.ff +22 -1
  14. package/core/Lock.ff +4 -4
  15. package/core/NodeSystem.ff +12 -3
  16. package/core/Path.ff +1 -1
  17. package/core/SourceLocation.ff +41 -0
  18. package/core/Stack.ff +6 -6
  19. package/core/StringMap.ff +3 -3
  20. package/lsp/LanguageServer.ff +32 -7
  21. package/lsp/stderr.txt +1 -0
  22. package/lsp/stdin.txt +11 -0
  23. package/lsp/stdout.txt +41 -0
  24. package/lux/.firefly/package.ff +2 -0
  25. package/lux/Lux.ff +473 -0
  26. package/lux/LuxEvent.ff +116 -0
  27. package/lux/Main.ff +126 -0
  28. package/lux/Main2.ff +144 -0
  29. package/meetup/AutoCompletion.ff +6 -0
  30. package/output/js/ff/compiler/Builder.mjs +444 -440
  31. package/output/js/ff/compiler/Compiler.mjs +416 -410
  32. package/output/js/ff/compiler/Dependencies.mjs +389 -385
  33. package/output/js/ff/compiler/Deriver.mjs +1170 -1166
  34. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1305
  35. package/output/js/ff/compiler/Environment.mjs +1015 -1005
  36. package/output/js/ff/compiler/Inference.mjs +4268 -4264
  37. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5353
  38. package/output/js/ff/compiler/JsImporter.mjs +266 -262
  39. package/output/js/ff/compiler/LspHook.mjs +793 -789
  40. package/output/js/ff/compiler/Main.mjs +1699 -1695
  41. package/output/js/ff/compiler/Parser.mjs +4008 -4004
  42. package/output/js/ff/compiler/Patterns.mjs +927 -923
  43. package/output/js/ff/compiler/Resolver.mjs +2307 -2303
  44. package/output/js/ff/compiler/Substitution.mjs +1150 -1146
  45. package/output/js/ff/compiler/Syntax.mjs +12434 -12430
  46. package/output/js/ff/compiler/Token.mjs +3096 -3092
  47. package/output/js/ff/compiler/Tokenizer.mjs +593 -589
  48. package/output/js/ff/compiler/Unification.mjs +1752 -1748
  49. package/output/js/ff/compiler/Wildcards.mjs +608 -604
  50. package/output/js/ff/compiler/Workspace.mjs +687 -683
  51. package/output/js/ff/core/Any.mjs +143 -139
  52. package/output/js/ff/core/Array.mjs +547 -543
  53. package/output/js/ff/core/AssetSystem.mjs +274 -270
  54. package/output/js/ff/core/Atomic.mjs +154 -150
  55. package/output/js/ff/core/Bool.mjs +152 -141
  56. package/output/js/ff/core/Box.mjs +112 -0
  57. package/output/js/ff/core/BrowserSystem.mjs +126 -122
  58. package/output/js/ff/core/Buffer.mjs +395 -391
  59. package/output/js/ff/core/BuildSystem.mjs +296 -290
  60. package/output/js/ff/core/Channel.mjs +189 -185
  61. package/output/js/ff/core/Char.mjs +149 -145
  62. package/output/js/ff/core/Core.mjs +300 -288
  63. package/output/js/ff/core/Duration.mjs +116 -112
  64. package/output/js/ff/core/Equal.mjs +179 -175
  65. package/output/js/ff/core/Error.mjs +142 -138
  66. package/output/js/ff/core/FileHandle.mjs +150 -146
  67. package/output/js/ff/core/Float.mjs +225 -214
  68. package/output/js/ff/core/HttpClient.mjs +190 -186
  69. package/output/js/ff/core/Instant.mjs +109 -105
  70. package/output/js/ff/core/Int.mjs +265 -254
  71. package/output/js/ff/core/IntMap.mjs +280 -276
  72. package/output/js/ff/core/JsSystem.mjs +238 -234
  73. package/output/js/ff/core/JsValue.mjs +714 -664
  74. package/output/js/ff/core/List.mjs +2334 -2321
  75. package/output/js/ff/core/Lock.mjs +230 -226
  76. package/output/js/ff/core/Log.mjs +163 -159
  77. package/output/js/ff/core/Map.mjs +362 -358
  78. package/output/js/ff/core/NodeSystem.mjs +302 -283
  79. package/output/js/ff/core/Nothing.mjs +104 -100
  80. package/output/js/ff/core/Option.mjs +1015 -1002
  81. package/output/js/ff/core/Ordering.mjs +730 -726
  82. package/output/js/ff/core/Pair.mjs +331 -318
  83. package/output/js/ff/core/Path.mjs +546 -542
  84. package/output/js/ff/core/RbMap.mjs +1940 -1936
  85. package/output/js/ff/core/Serializable.mjs +428 -424
  86. package/output/js/ff/core/Set.mjs +254 -250
  87. package/output/js/ff/core/Show.mjs +205 -201
  88. package/output/js/ff/core/SourceLocation.mjs +229 -0
  89. package/output/js/ff/core/Stack.mjs +541 -537
  90. package/output/js/ff/core/Stream.mjs +1304 -1300
  91. package/output/js/ff/core/String.mjs +365 -354
  92. package/output/js/ff/core/StringMap.mjs +280 -276
  93. package/output/js/ff/core/Task.mjs +320 -316
  94. package/output/js/ff/core/Try.mjs +507 -503
  95. package/output/js/ff/core/Unit.mjs +151 -103
  96. package/package.json +29 -29
  97. package/vscode/package-lock.json +5 -5
  98. package/vscode/package.json +1 -1
@@ -1,1002 +1,1015 @@
1
-
2
-
3
- import * as ff_core_Any from "../../ff/core/Any.mjs"
4
-
5
- import * as ff_core_Array from "../../ff/core/Array.mjs"
6
-
7
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
-
9
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
-
11
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
-
13
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
14
-
15
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
16
-
17
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
18
-
19
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
20
-
21
- import * as ff_core_Char from "../../ff/core/Char.mjs"
22
-
23
- import * as ff_core_Core from "../../ff/core/Core.mjs"
24
-
25
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
26
-
27
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
28
-
29
- import * as ff_core_Error from "../../ff/core/Error.mjs"
30
-
31
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
32
-
33
- import * as ff_core_Float from "../../ff/core/Float.mjs"
34
-
35
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
36
-
37
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
38
-
39
- import * as ff_core_Int from "../../ff/core/Int.mjs"
40
-
41
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
42
-
43
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
44
-
45
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
46
-
47
- import * as ff_core_List from "../../ff/core/List.mjs"
48
-
49
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
50
-
51
- import * as ff_core_Log from "../../ff/core/Log.mjs"
52
-
53
- import * as ff_core_Map from "../../ff/core/Map.mjs"
54
-
55
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
56
-
57
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
58
-
59
- import * as ff_core_Option from "../../ff/core/Option.mjs"
60
-
61
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
62
-
63
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
64
-
65
- import * as ff_core_Path from "../../ff/core/Path.mjs"
66
-
67
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
68
-
69
- import * as ff_core_Set from "../../ff/core/Set.mjs"
70
-
71
- import * as ff_core_Show from "../../ff/core/Show.mjs"
72
-
73
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
74
-
75
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
76
-
77
- import * as ff_core_String from "../../ff/core/String.mjs"
78
-
79
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
80
-
81
- import * as ff_core_Task from "../../ff/core/Task.mjs"
82
-
83
- import * as ff_core_Try from "../../ff/core/Try.mjs"
84
-
85
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
86
-
87
- // type Option
88
- const None$ = {None: true};
89
- export function None() {
90
- return None$;
91
- }
92
- export function Some(value_) {
93
- return {Some: true, value_};
94
- }
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
- export function Option_else(self_, body_) {
103
- {
104
- const _1 = self_;
105
- {
106
- if(_1.None) {
107
- return body_()
108
- return
109
- }
110
- }
111
- {
112
- if(_1.Some) {
113
- const value_ = _1.value_;
114
- return value_
115
- return
116
- }
117
- }
118
- }
119
- }
120
-
121
- export function Option_elseIf(self_, condition_, body_) {
122
- {
123
- const _1 = self_;
124
- {
125
- if(_1.None) {
126
- {
127
- const _1 = condition_();
128
- {
129
- if(_1) {
130
- return ff_core_Option.Some(body_())
131
- return
132
- }
133
- }
134
- {
135
- if(!_1) {
136
- return ff_core_Option.None()
137
- return
138
- }
139
- }
140
- }
141
- return
142
- }
143
- }
144
- {
145
- if(_1.Some) {
146
- return self_
147
- return
148
- }
149
- }
150
- }
151
- }
152
-
153
- export function Option_orElse(self_, body_) {
154
- {
155
- const _1 = self_;
156
- {
157
- if(_1.None) {
158
- return body_()
159
- return
160
- }
161
- }
162
- {
163
- if(_1.Some) {
164
- return self_
165
- return
166
- }
167
- }
168
- }
169
- }
170
-
171
- export function Option_isEmpty(self_) {
172
- {
173
- const _1 = self_;
174
- {
175
- if(_1.None) {
176
- return true
177
- return
178
- }
179
- }
180
- {
181
- if(_1.Some) {
182
- return false
183
- return
184
- }
185
- }
186
- }
187
- }
188
-
189
- export function Option_toList(self_) {
190
- {
191
- const _1 = self_;
192
- {
193
- if(_1.None) {
194
- return ff_core_List.Empty()
195
- return
196
- }
197
- }
198
- {
199
- if(_1.Some) {
200
- const v_ = _1.value_;
201
- return ff_core_List.Link(v_, ff_core_List.Empty())
202
- return
203
- }
204
- }
205
- }
206
- }
207
-
208
- export function Option_toStack(self_) {
209
- return ff_core_List.List_toStack(ff_core_Option.Option_toList(self_))
210
- }
211
-
212
- export function Option_toArray(self_) {
213
- return ff_core_List.List_toArray(ff_core_Option.Option_toList(self_))
214
- }
215
-
216
- export function Option_toStream(self_, cycle_ = false) {
217
- let next_ = self_;
218
- return ff_core_Stream.make_((() => {
219
- const result_ = next_;
220
- if((!cycle_)) {
221
- next_ = ff_core_Option.None()
222
- };
223
- return result_
224
- }), (() => {
225
-
226
- }))
227
- }
228
-
229
- export function Option_filter(self_, body_) {
230
- {
231
- const _1 = self_;
232
- {
233
- if(_1.Some) {
234
- const v_ = _1.value_;
235
- const _guard1 = body_(v_);
236
- if(_guard1) {
237
- return ff_core_Option.Some(v_)
238
- return
239
- }
240
- }
241
- }
242
- {
243
- return ff_core_Option.None()
244
- return
245
- }
246
- }
247
- }
248
-
249
- export function Option_map(self_, body_) {
250
- {
251
- const _1 = self_;
252
- {
253
- if(_1.None) {
254
- return ff_core_Option.None()
255
- return
256
- }
257
- }
258
- {
259
- if(_1.Some) {
260
- const v_ = _1.value_;
261
- return ff_core_Option.Some(body_(v_))
262
- return
263
- }
264
- }
265
- }
266
- }
267
-
268
- export function Option_flatMap(self_, body_) {
269
- {
270
- const _1 = self_;
271
- {
272
- if(_1.None) {
273
- return ff_core_Option.None()
274
- return
275
- }
276
- }
277
- {
278
- if(_1.Some) {
279
- const v_ = _1.value_;
280
- return body_(v_)
281
- return
282
- }
283
- }
284
- }
285
- }
286
-
287
- export function Option_each(self_, body_) {
288
- {
289
- const _1 = self_;
290
- {
291
- if(_1.None) {
292
-
293
- return
294
- }
295
- }
296
- {
297
- if(_1.Some) {
298
- const v_ = _1.value_;
299
- body_(v_)
300
- return
301
- }
302
- }
303
- }
304
- }
305
-
306
- export function Option_all(self_, body_) {
307
- {
308
- const _1 = self_;
309
- {
310
- if(_1.None) {
311
- return true
312
- return
313
- }
314
- }
315
- {
316
- if(_1.Some) {
317
- const v_ = _1.value_;
318
- return body_(v_)
319
- return
320
- }
321
- }
322
- }
323
- }
324
-
325
- export function Option_any(self_, body_) {
326
- {
327
- const _1 = self_;
328
- {
329
- if(_1.None) {
330
- return false
331
- return
332
- }
333
- }
334
- {
335
- if(_1.Some) {
336
- const v_ = _1.value_;
337
- return body_(v_)
338
- return
339
- }
340
- }
341
- }
342
- }
343
-
344
- export function Option_grab(self_) {
345
- {
346
- const _1 = self_;
347
- {
348
- if(_1.None) {
349
- return ff_core_Try.internalThrowGrabException_()
350
- return
351
- }
352
- }
353
- {
354
- if(_1.Some) {
355
- const v_ = _1.value_;
356
- return v_
357
- return
358
- }
359
- }
360
- }
361
- }
362
-
363
- export async function Option_else$(self_, body_, $task) {
364
- {
365
- const _1 = self_;
366
- {
367
- if(_1.None) {
368
- return (await body_($task))
369
- return
370
- }
371
- }
372
- {
373
- if(_1.Some) {
374
- const value_ = _1.value_;
375
- return value_
376
- return
377
- }
378
- }
379
- }
380
- }
381
-
382
- export async function Option_elseIf$(self_, condition_, body_, $task) {
383
- {
384
- const _1 = self_;
385
- {
386
- if(_1.None) {
387
- {
388
- const _1 = (await condition_($task));
389
- {
390
- if(_1) {
391
- return ff_core_Option.Some((await body_($task)))
392
- return
393
- }
394
- }
395
- {
396
- if(!_1) {
397
- return ff_core_Option.None()
398
- return
399
- }
400
- }
401
- }
402
- return
403
- }
404
- }
405
- {
406
- if(_1.Some) {
407
- return self_
408
- return
409
- }
410
- }
411
- }
412
- }
413
-
414
- export async function Option_orElse$(self_, body_, $task) {
415
- {
416
- const _1 = self_;
417
- {
418
- if(_1.None) {
419
- return (await body_($task))
420
- return
421
- }
422
- }
423
- {
424
- if(_1.Some) {
425
- return self_
426
- return
427
- }
428
- }
429
- }
430
- }
431
-
432
- export async function Option_isEmpty$(self_, $task) {
433
- {
434
- const _1 = self_;
435
- {
436
- if(_1.None) {
437
- return true
438
- return
439
- }
440
- }
441
- {
442
- if(_1.Some) {
443
- return false
444
- return
445
- }
446
- }
447
- }
448
- }
449
-
450
- export async function Option_toList$(self_, $task) {
451
- {
452
- const _1 = self_;
453
- {
454
- if(_1.None) {
455
- return ff_core_List.Empty()
456
- return
457
- }
458
- }
459
- {
460
- if(_1.Some) {
461
- const v_ = _1.value_;
462
- return ff_core_List.Link(v_, ff_core_List.Empty())
463
- return
464
- }
465
- }
466
- }
467
- }
468
-
469
- export async function Option_toStack$(self_, $task) {
470
- return ff_core_List.List_toStack(ff_core_Option.Option_toList(self_))
471
- }
472
-
473
- export async function Option_toArray$(self_, $task) {
474
- return ff_core_List.List_toArray(ff_core_Option.Option_toList(self_))
475
- }
476
-
477
- export async function Option_toStream$(self_, cycle_ = false, $task) {
478
- let next_ = self_;
479
- return (await ff_core_Stream.make_$((async ($task) => {
480
- const result_ = next_;
481
- if((!cycle_)) {
482
- next_ = ff_core_Option.None()
483
- };
484
- return result_
485
- }), (async ($task) => {
486
-
487
- }), $task))
488
- }
489
-
490
- export async function Option_filter$(self_, body_, $task) {
491
- {
492
- const _1 = self_;
493
- {
494
- if(_1.Some) {
495
- const v_ = _1.value_;
496
- const _guard1 = (await body_(v_, $task));
497
- if(_guard1) {
498
- return ff_core_Option.Some(v_)
499
- return
500
- }
501
- }
502
- }
503
- {
504
- return ff_core_Option.None()
505
- return
506
- }
507
- }
508
- }
509
-
510
- export async function Option_map$(self_, body_, $task) {
511
- {
512
- const _1 = self_;
513
- {
514
- if(_1.None) {
515
- return ff_core_Option.None()
516
- return
517
- }
518
- }
519
- {
520
- if(_1.Some) {
521
- const v_ = _1.value_;
522
- return ff_core_Option.Some((await body_(v_, $task)))
523
- return
524
- }
525
- }
526
- }
527
- }
528
-
529
- export async function Option_flatMap$(self_, body_, $task) {
530
- {
531
- const _1 = self_;
532
- {
533
- if(_1.None) {
534
- return ff_core_Option.None()
535
- return
536
- }
537
- }
538
- {
539
- if(_1.Some) {
540
- const v_ = _1.value_;
541
- return (await body_(v_, $task))
542
- return
543
- }
544
- }
545
- }
546
- }
547
-
548
- export async function Option_each$(self_, body_, $task) {
549
- {
550
- const _1 = self_;
551
- {
552
- if(_1.None) {
553
-
554
- return
555
- }
556
- }
557
- {
558
- if(_1.Some) {
559
- const v_ = _1.value_;
560
- (await body_(v_, $task))
561
- return
562
- }
563
- }
564
- }
565
- }
566
-
567
- export async function Option_all$(self_, body_, $task) {
568
- {
569
- const _1 = self_;
570
- {
571
- if(_1.None) {
572
- return true
573
- return
574
- }
575
- }
576
- {
577
- if(_1.Some) {
578
- const v_ = _1.value_;
579
- return (await body_(v_, $task))
580
- return
581
- }
582
- }
583
- }
584
- }
585
-
586
- export async function Option_any$(self_, body_, $task) {
587
- {
588
- const _1 = self_;
589
- {
590
- if(_1.None) {
591
- return false
592
- return
593
- }
594
- }
595
- {
596
- if(_1.Some) {
597
- const v_ = _1.value_;
598
- return (await body_(v_, $task))
599
- return
600
- }
601
- }
602
- }
603
- }
604
-
605
- export async function Option_grab$(self_, $task) {
606
- {
607
- const _1 = self_;
608
- {
609
- if(_1.None) {
610
- return ff_core_Try.internalThrowGrabException_()
611
- return
612
- }
613
- }
614
- {
615
- if(_1.Some) {
616
- const v_ = _1.value_;
617
- return v_
618
- return
619
- }
620
- }
621
- }
622
- }
623
-
624
- export function Option_contains(self_, value_, ff_core_Equal_Equal$T) {
625
- {
626
- const _1 = self_;
627
- {
628
- if(_1.None) {
629
- return false
630
- return
631
- }
632
- }
633
- {
634
- if(_1.Some) {
635
- const v_ = _1.value_;
636
- return ff_core_Equal_Equal$T.equals_(v_, value_)
637
- return
638
- }
639
- }
640
- }
641
- }
642
-
643
- export async function Option_contains$(self_, value_, ff_core_Equal_Equal$T, $task) {
644
- {
645
- const _1 = self_;
646
- {
647
- if(_1.None) {
648
- return false
649
- return
650
- }
651
- }
652
- {
653
- if(_1.Some) {
654
- const v_ = _1.value_;
655
- return ff_core_Equal_Equal$T.equals_(v_, value_)
656
- return
657
- }
658
- }
659
- }
660
- }
661
-
662
- export function Option_flatten(self_) {
663
- {
664
- const _1 = self_;
665
- {
666
- if(_1.None) {
667
- return ff_core_Option.None()
668
- return
669
- }
670
- }
671
- {
672
- if(_1.Some) {
673
- const v_ = _1.value_;
674
- return v_
675
- return
676
- }
677
- }
678
- }
679
- }
680
-
681
- export async function Option_flatten$(self_, $task) {
682
- {
683
- const _1 = self_;
684
- {
685
- if(_1.None) {
686
- return ff_core_Option.None()
687
- return
688
- }
689
- }
690
- {
691
- if(_1.Some) {
692
- const v_ = _1.value_;
693
- return v_
694
- return
695
- }
696
- }
697
- }
698
- }
699
-
700
- export function ff_core_Show_Show$ff_core_Option_Option(ff_core_Show_Show$T) { return {
701
- show_(value_) {
702
- {
703
- const value_a = value_;
704
- {
705
- if(value_a.None) {
706
- const z_ = value_a;
707
- return "None"
708
- return
709
- }
710
- }
711
- {
712
- if(value_a.Some) {
713
- const z_ = value_a;
714
- return ((("Some" + "(") + ff_core_Show_Show$T.show_(z_.value_)) + ")")
715
- return
716
- }
717
- }
718
- }
719
- },
720
- async show_$(value_, $task) {
721
- {
722
- const value_a = value_;
723
- {
724
- if(value_a.None) {
725
- const z_ = value_a;
726
- return "None"
727
- return
728
- }
729
- }
730
- {
731
- if(value_a.Some) {
732
- const z_ = value_a;
733
- return ((("Some" + "(") + ff_core_Show_Show$T.show_(z_.value_)) + ")")
734
- return
735
- }
736
- }
737
- }
738
- }
739
- }}
740
-
741
- export function ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal_Equal$T) { return {
742
- equals_(x_, y_) {
743
- {
744
- const x_a = x_;
745
- const y_a = y_;
746
- {
747
- const _guard1 = (x_ === y_);
748
- if(_guard1) {
749
- return true
750
- return
751
- }
752
- }
753
- {
754
- if(x_a.Some) {
755
- const x_ = x_a;
756
- if(y_a.Some) {
757
- const y_ = y_a;
758
- return ff_core_Equal_Equal$T.equals_(x_.value_, y_.value_)
759
- return
760
- }
761
- }
762
- }
763
- {
764
- return false
765
- return
766
- }
767
- }
768
- },
769
- async equals_$(x_, y_, $task) {
770
- {
771
- const x_a = x_;
772
- const y_a = y_;
773
- {
774
- const _guard1 = (x_ === y_);
775
- if(_guard1) {
776
- return true
777
- return
778
- }
779
- }
780
- {
781
- if(x_a.Some) {
782
- const x_ = x_a;
783
- if(y_a.Some) {
784
- const y_ = y_a;
785
- return ff_core_Equal_Equal$T.equals_(x_.value_, y_.value_)
786
- return
787
- }
788
- }
789
- }
790
- {
791
- return false
792
- return
793
- }
794
- }
795
- }
796
- }}
797
-
798
- export function ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering_Order$T) { return {
799
- compare_(x_, y_) {
800
- {
801
- const x_a = x_;
802
- const y_a = y_;
803
- {
804
- const _guard1 = (x_ === y_);
805
- if(_guard1) {
806
- return ff_core_Ordering.OrderingSame()
807
- return
808
- }
809
- }
810
- {
811
- if(x_a.Some) {
812
- const x_ = x_a;
813
- if(y_a.Some) {
814
- const y_ = y_a;
815
- const valueOrdering_ = ff_core_Ordering_Order$T.compare_(x_.value_, y_.value_);
816
- if((valueOrdering_ !== ff_core_Ordering.OrderingSame())) {
817
- return valueOrdering_
818
- } else {
819
- return ff_core_Ordering.OrderingSame()
820
- }
821
- return
822
- }
823
- }
824
- }
825
- {
826
- function number_(z_) {
827
- {
828
- const z_a = z_;
829
- {
830
- if(z_a.None) {
831
- return 0
832
- return
833
- }
834
- }
835
- {
836
- if(z_a.Some) {
837
- return 1
838
- return
839
- }
840
- }
841
- }
842
- }
843
- return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
844
- return
845
- }
846
- }
847
- },
848
- async compare_$(x_, y_, $task) {
849
- {
850
- const x_a = x_;
851
- const y_a = y_;
852
- {
853
- const _guard1 = (x_ === y_);
854
- if(_guard1) {
855
- return ff_core_Ordering.OrderingSame()
856
- return
857
- }
858
- }
859
- {
860
- if(x_a.Some) {
861
- const x_ = x_a;
862
- if(y_a.Some) {
863
- const y_ = y_a;
864
- const valueOrdering_ = ff_core_Ordering_Order$T.compare_(x_.value_, y_.value_);
865
- if((valueOrdering_ !== ff_core_Ordering.OrderingSame())) {
866
- return valueOrdering_
867
- } else {
868
- return ff_core_Ordering.OrderingSame()
869
- }
870
- return
871
- }
872
- }
873
- }
874
- {
875
- function number_(z_) {
876
- {
877
- const z_a = z_;
878
- {
879
- if(z_a.None) {
880
- return 0
881
- return
882
- }
883
- }
884
- {
885
- if(z_a.Some) {
886
- return 1
887
- return
888
- }
889
- }
890
- }
891
- }
892
- return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
893
- return
894
- }
895
- }
896
- }
897
- }}
898
-
899
- export function ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable_Serializable$T) { return {
900
- serializeUsing_(serialization_, value_) {
901
- {
902
- const serialization_a = serialization_;
903
- const value_a = value_;
904
- {
905
- if(value_a.None) {
906
- const v_ = value_a;
907
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
908
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
909
- serialization_.offset_ += 1
910
- return
911
- }
912
- }
913
- {
914
- if(value_a.Some) {
915
- const v_ = value_a;
916
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
917
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
918
- serialization_.offset_ += 1;
919
- ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, v_.value_)
920
- return
921
- }
922
- }
923
- }
924
- },
925
- deserializeUsing_(serialization_) {
926
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
927
- serialization_.offset_ += 1;
928
- {
929
- const _1 = variantIndex_;
930
- {
931
- if(_1 == 0) {
932
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
933
- return ff_core_Option.None()
934
- return
935
- }
936
- }
937
- {
938
- if(_1 == 1) {
939
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
940
- return ff_core_Option.Some(ff_core_Serializable_Serializable$T.deserializeUsing_(serialization_))
941
- return
942
- }
943
- }
944
- {
945
- 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)})
946
- return
947
- }
948
- }
949
- },
950
- async serializeUsing_$(serialization_, value_, $task) {
951
- {
952
- const serialization_a = serialization_;
953
- const value_a = value_;
954
- {
955
- if(value_a.None) {
956
- const v_ = value_a;
957
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
958
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
959
- serialization_.offset_ += 1
960
- return
961
- }
962
- }
963
- {
964
- if(value_a.Some) {
965
- const v_ = value_a;
966
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
967
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
968
- serialization_.offset_ += 1;
969
- ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, v_.value_)
970
- return
971
- }
972
- }
973
- }
974
- },
975
- async deserializeUsing_$(serialization_, $task) {
976
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
977
- serialization_.offset_ += 1;
978
- {
979
- const _1 = variantIndex_;
980
- {
981
- if(_1 == 0) {
982
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
983
- return ff_core_Option.None()
984
- return
985
- }
986
- }
987
- {
988
- if(_1 == 1) {
989
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
990
- return ff_core_Option.Some(ff_core_Serializable_Serializable$T.deserializeUsing_(serialization_))
991
- return
992
- }
993
- }
994
- {
995
- 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)})
996
- return
997
- }
998
- }
999
- }
1000
- }}
1001
-
1002
-
1
+
2
+
3
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
4
+
5
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
6
+
7
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
+
9
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
+
11
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
+
13
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
14
+
15
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
16
+
17
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
18
+
19
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
20
+
21
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
22
+
23
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
24
+
25
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
26
+
27
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
28
+
29
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
30
+
31
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
32
+
33
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
34
+
35
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
36
+
37
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
38
+
39
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
40
+
41
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
42
+
43
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
+
45
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
+
47
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
48
+
49
+ import * as ff_core_List from "../../ff/core/List.mjs"
50
+
51
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
52
+
53
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
54
+
55
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
56
+
57
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
58
+
59
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
60
+
61
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
62
+
63
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
64
+
65
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
66
+
67
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
68
+
69
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
70
+
71
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
72
+
73
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
74
+
75
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
76
+
77
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
78
+
79
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
80
+
81
+ import * as ff_core_String from "../../ff/core/String.mjs"
82
+
83
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
84
+
85
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
86
+
87
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
88
+
89
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
90
+
91
+ // type Option
92
+ const None$ = {None: true};
93
+ export function None() {
94
+ return None$;
95
+ }
96
+ export function Some(value_) {
97
+ return {Some: true, value_};
98
+ }
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ export function Option_else(self_, body_) {
107
+ {
108
+ const _1 = self_;
109
+ {
110
+ if(_1.None) {
111
+ return body_()
112
+ return
113
+ }
114
+ }
115
+ {
116
+ if(_1.Some) {
117
+ const value_ = _1.value_;
118
+ return value_
119
+ return
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ export function Option_elseIf(self_, condition_, body_) {
126
+ {
127
+ const _1 = self_;
128
+ {
129
+ if(_1.None) {
130
+ {
131
+ const _1 = condition_();
132
+ {
133
+ if(_1) {
134
+ return ff_core_Option.Some(body_())
135
+ return
136
+ }
137
+ }
138
+ {
139
+ if(!_1) {
140
+ return ff_core_Option.None()
141
+ return
142
+ }
143
+ }
144
+ }
145
+ return
146
+ }
147
+ }
148
+ {
149
+ if(_1.Some) {
150
+ return self_
151
+ return
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ export function Option_orElse(self_, body_) {
158
+ {
159
+ const _1 = self_;
160
+ {
161
+ if(_1.None) {
162
+ return body_()
163
+ return
164
+ }
165
+ }
166
+ {
167
+ if(_1.Some) {
168
+ return self_
169
+ return
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ export function Option_isEmpty(self_) {
176
+ {
177
+ const _1 = self_;
178
+ {
179
+ if(_1.None) {
180
+ return true
181
+ return
182
+ }
183
+ }
184
+ {
185
+ if(_1.Some) {
186
+ return false
187
+ return
188
+ }
189
+ }
190
+ }
191
+ }
192
+
193
+ export function Option_toList(self_) {
194
+ {
195
+ const _1 = self_;
196
+ {
197
+ if(_1.None) {
198
+ return ff_core_List.Empty()
199
+ return
200
+ }
201
+ }
202
+ {
203
+ if(_1.Some) {
204
+ const v_ = _1.value_;
205
+ return ff_core_List.Link(v_, ff_core_List.Empty())
206
+ return
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ export function Option_toStack(self_) {
213
+ return ff_core_List.List_toStack(ff_core_Option.Option_toList(self_))
214
+ }
215
+
216
+ export function Option_toArray(self_) {
217
+ return ff_core_List.List_toArray(ff_core_Option.Option_toList(self_))
218
+ }
219
+
220
+ export function Option_toStream(self_, cycle_ = false) {
221
+ let next_ = self_;
222
+ return ff_core_Stream.make_((() => {
223
+ const result_ = next_;
224
+ if((!cycle_)) {
225
+ next_ = ff_core_Option.None()
226
+ };
227
+ return result_
228
+ }), (() => {
229
+
230
+ }))
231
+ }
232
+
233
+ export function Option_filter(self_, body_) {
234
+ {
235
+ const _1 = self_;
236
+ {
237
+ if(_1.Some) {
238
+ const v_ = _1.value_;
239
+ const _guard1 = body_(v_);
240
+ if(_guard1) {
241
+ return ff_core_Option.Some(v_)
242
+ return
243
+ }
244
+ }
245
+ }
246
+ {
247
+ return ff_core_Option.None()
248
+ return
249
+ }
250
+ }
251
+ }
252
+
253
+ export function Option_map(self_, body_) {
254
+ {
255
+ const _1 = self_;
256
+ {
257
+ if(_1.None) {
258
+ return ff_core_Option.None()
259
+ return
260
+ }
261
+ }
262
+ {
263
+ if(_1.Some) {
264
+ const v_ = _1.value_;
265
+ return ff_core_Option.Some(body_(v_))
266
+ return
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ export function Option_flatMap(self_, body_) {
273
+ {
274
+ const _1 = self_;
275
+ {
276
+ if(_1.None) {
277
+ return ff_core_Option.None()
278
+ return
279
+ }
280
+ }
281
+ {
282
+ if(_1.Some) {
283
+ const v_ = _1.value_;
284
+ return body_(v_)
285
+ return
286
+ }
287
+ }
288
+ }
289
+ }
290
+
291
+ export function Option_each(self_, body_) {
292
+ {
293
+ const _1 = self_;
294
+ {
295
+ if(_1.None) {
296
+
297
+ return
298
+ }
299
+ }
300
+ {
301
+ if(_1.Some) {
302
+ const v_ = _1.value_;
303
+ body_(v_)
304
+ return
305
+ }
306
+ }
307
+ }
308
+ }
309
+
310
+ export function Option_all(self_, body_) {
311
+ {
312
+ const _1 = self_;
313
+ {
314
+ if(_1.None) {
315
+ return true
316
+ return
317
+ }
318
+ }
319
+ {
320
+ if(_1.Some) {
321
+ const v_ = _1.value_;
322
+ return body_(v_)
323
+ return
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+ export function Option_any(self_, body_) {
330
+ {
331
+ const _1 = self_;
332
+ {
333
+ if(_1.None) {
334
+ return false
335
+ return
336
+ }
337
+ }
338
+ {
339
+ if(_1.Some) {
340
+ const v_ = _1.value_;
341
+ return body_(v_)
342
+ return
343
+ }
344
+ }
345
+ }
346
+ }
347
+
348
+ export function Option_grab(self_) {
349
+ {
350
+ const _1 = self_;
351
+ {
352
+ if(_1.None) {
353
+ return ff_core_Try.internalThrowGrabException_()
354
+ return
355
+ }
356
+ }
357
+ {
358
+ if(_1.Some) {
359
+ const v_ = _1.value_;
360
+ return v_
361
+ return
362
+ }
363
+ }
364
+ }
365
+ }
366
+
367
+ export async function Option_else$(self_, body_, $task) {
368
+ {
369
+ const _1 = self_;
370
+ {
371
+ if(_1.None) {
372
+ return (await body_($task))
373
+ return
374
+ }
375
+ }
376
+ {
377
+ if(_1.Some) {
378
+ const value_ = _1.value_;
379
+ return value_
380
+ return
381
+ }
382
+ }
383
+ }
384
+ }
385
+
386
+ export async function Option_elseIf$(self_, condition_, body_, $task) {
387
+ {
388
+ const _1 = self_;
389
+ {
390
+ if(_1.None) {
391
+ {
392
+ const _1 = (await condition_($task));
393
+ {
394
+ if(_1) {
395
+ return ff_core_Option.Some((await body_($task)))
396
+ return
397
+ }
398
+ }
399
+ {
400
+ if(!_1) {
401
+ return ff_core_Option.None()
402
+ return
403
+ }
404
+ }
405
+ }
406
+ return
407
+ }
408
+ }
409
+ {
410
+ if(_1.Some) {
411
+ return self_
412
+ return
413
+ }
414
+ }
415
+ }
416
+ }
417
+
418
+ export async function Option_orElse$(self_, body_, $task) {
419
+ {
420
+ const _1 = self_;
421
+ {
422
+ if(_1.None) {
423
+ return (await body_($task))
424
+ return
425
+ }
426
+ }
427
+ {
428
+ if(_1.Some) {
429
+ return self_
430
+ return
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ export async function Option_isEmpty$(self_, $task) {
437
+ {
438
+ const _1 = self_;
439
+ {
440
+ if(_1.None) {
441
+ return true
442
+ return
443
+ }
444
+ }
445
+ {
446
+ if(_1.Some) {
447
+ return false
448
+ return
449
+ }
450
+ }
451
+ }
452
+ }
453
+
454
+ export async function Option_toList$(self_, $task) {
455
+ {
456
+ const _1 = self_;
457
+ {
458
+ if(_1.None) {
459
+ return ff_core_List.Empty()
460
+ return
461
+ }
462
+ }
463
+ {
464
+ if(_1.Some) {
465
+ const v_ = _1.value_;
466
+ return ff_core_List.Link(v_, ff_core_List.Empty())
467
+ return
468
+ }
469
+ }
470
+ }
471
+ }
472
+
473
+ export async function Option_toStack$(self_, $task) {
474
+ return ff_core_List.List_toStack(ff_core_Option.Option_toList(self_))
475
+ }
476
+
477
+ export async function Option_toArray$(self_, $task) {
478
+ return ff_core_List.List_toArray(ff_core_Option.Option_toList(self_))
479
+ }
480
+
481
+ export async function Option_toStream$(self_, cycle_ = false, $task) {
482
+ let next_ = self_;
483
+ return (await ff_core_Stream.make_$((async ($task) => {
484
+ const result_ = next_;
485
+ if((!cycle_)) {
486
+ next_ = ff_core_Option.None()
487
+ };
488
+ return result_
489
+ }), (async ($task) => {
490
+
491
+ }), $task))
492
+ }
493
+
494
+ export async function Option_filter$(self_, body_, $task) {
495
+ {
496
+ const _1 = self_;
497
+ {
498
+ if(_1.Some) {
499
+ const v_ = _1.value_;
500
+ const _guard1 = (await body_(v_, $task));
501
+ if(_guard1) {
502
+ return ff_core_Option.Some(v_)
503
+ return
504
+ }
505
+ }
506
+ }
507
+ {
508
+ return ff_core_Option.None()
509
+ return
510
+ }
511
+ }
512
+ }
513
+
514
+ export async function Option_map$(self_, body_, $task) {
515
+ {
516
+ const _1 = self_;
517
+ {
518
+ if(_1.None) {
519
+ return ff_core_Option.None()
520
+ return
521
+ }
522
+ }
523
+ {
524
+ if(_1.Some) {
525
+ const v_ = _1.value_;
526
+ return ff_core_Option.Some((await body_(v_, $task)))
527
+ return
528
+ }
529
+ }
530
+ }
531
+ }
532
+
533
+ export async function Option_flatMap$(self_, body_, $task) {
534
+ {
535
+ const _1 = self_;
536
+ {
537
+ if(_1.None) {
538
+ return ff_core_Option.None()
539
+ return
540
+ }
541
+ }
542
+ {
543
+ if(_1.Some) {
544
+ const v_ = _1.value_;
545
+ return (await body_(v_, $task))
546
+ return
547
+ }
548
+ }
549
+ }
550
+ }
551
+
552
+ export async function Option_each$(self_, body_, $task) {
553
+ {
554
+ const _1 = self_;
555
+ {
556
+ if(_1.None) {
557
+
558
+ return
559
+ }
560
+ }
561
+ {
562
+ if(_1.Some) {
563
+ const v_ = _1.value_;
564
+ (await body_(v_, $task))
565
+ return
566
+ }
567
+ }
568
+ }
569
+ }
570
+
571
+ export async function Option_all$(self_, body_, $task) {
572
+ {
573
+ const _1 = self_;
574
+ {
575
+ if(_1.None) {
576
+ return true
577
+ return
578
+ }
579
+ }
580
+ {
581
+ if(_1.Some) {
582
+ const v_ = _1.value_;
583
+ return (await body_(v_, $task))
584
+ return
585
+ }
586
+ }
587
+ }
588
+ }
589
+
590
+ export async function Option_any$(self_, body_, $task) {
591
+ {
592
+ const _1 = self_;
593
+ {
594
+ if(_1.None) {
595
+ return false
596
+ return
597
+ }
598
+ }
599
+ {
600
+ if(_1.Some) {
601
+ const v_ = _1.value_;
602
+ return (await body_(v_, $task))
603
+ return
604
+ }
605
+ }
606
+ }
607
+ }
608
+
609
+ export async function Option_grab$(self_, $task) {
610
+ {
611
+ const _1 = self_;
612
+ {
613
+ if(_1.None) {
614
+ return ff_core_Try.internalThrowGrabException_()
615
+ return
616
+ }
617
+ }
618
+ {
619
+ if(_1.Some) {
620
+ const v_ = _1.value_;
621
+ return v_
622
+ return
623
+ }
624
+ }
625
+ }
626
+ }
627
+
628
+ export function Option_contains(self_, value_, ff_core_Equal_Equal$T) {
629
+ {
630
+ const _1 = self_;
631
+ {
632
+ if(_1.None) {
633
+ return false
634
+ return
635
+ }
636
+ }
637
+ {
638
+ if(_1.Some) {
639
+ const v_ = _1.value_;
640
+ return ff_core_Equal_Equal$T.equals_(v_, value_)
641
+ return
642
+ }
643
+ }
644
+ }
645
+ }
646
+
647
+ export async function Option_contains$(self_, value_, ff_core_Equal_Equal$T, $task) {
648
+ {
649
+ const _1 = self_;
650
+ {
651
+ if(_1.None) {
652
+ return false
653
+ return
654
+ }
655
+ }
656
+ {
657
+ if(_1.Some) {
658
+ const v_ = _1.value_;
659
+ return ff_core_Equal_Equal$T.equals_(v_, value_)
660
+ return
661
+ }
662
+ }
663
+ }
664
+ }
665
+
666
+ export function Option_flatten(self_) {
667
+ {
668
+ const _1 = self_;
669
+ {
670
+ if(_1.None) {
671
+ return ff_core_Option.None()
672
+ return
673
+ }
674
+ }
675
+ {
676
+ if(_1.Some) {
677
+ const v_ = _1.value_;
678
+ return v_
679
+ return
680
+ }
681
+ }
682
+ }
683
+ }
684
+
685
+ export async function Option_flatten$(self_, $task) {
686
+ {
687
+ const _1 = self_;
688
+ {
689
+ if(_1.None) {
690
+ return ff_core_Option.None()
691
+ return
692
+ }
693
+ }
694
+ {
695
+ if(_1.Some) {
696
+ const v_ = _1.value_;
697
+ return v_
698
+ return
699
+ }
700
+ }
701
+ }
702
+ }
703
+
704
+ export function ff_core_Any_HasAnyTag$ff_core_Option_Option(ff_core_Any_HasAnyTag$T) { return {
705
+ anyTag_() {
706
+ return ff_core_Any.internalAnyTag_(((("ff:core/Option.Option" + "[") + ff_core_Any.AnyTag_show(ff_core_Any_HasAnyTag$T.anyTag_())) + "]"))
707
+ },
708
+ async anyTag_$($task) {
709
+ return ff_core_Any.internalAnyTag_(((("ff:core/Option.Option" + "[") + ff_core_Any.AnyTag_show(ff_core_Any_HasAnyTag$T.anyTag_())) + "]"))
710
+ }
711
+ }}
712
+
713
+ export function ff_core_Show_Show$ff_core_Option_Option(ff_core_Show_Show$T) { return {
714
+ show_(value_) {
715
+ {
716
+ const value_a = value_;
717
+ {
718
+ if(value_a.None) {
719
+ const z_ = value_a;
720
+ return "None"
721
+ return
722
+ }
723
+ }
724
+ {
725
+ if(value_a.Some) {
726
+ const z_ = value_a;
727
+ return ((("Some" + "(") + ff_core_Show_Show$T.show_(z_.value_)) + ")")
728
+ return
729
+ }
730
+ }
731
+ }
732
+ },
733
+ async show_$(value_, $task) {
734
+ {
735
+ const value_a = value_;
736
+ {
737
+ if(value_a.None) {
738
+ const z_ = value_a;
739
+ return "None"
740
+ return
741
+ }
742
+ }
743
+ {
744
+ if(value_a.Some) {
745
+ const z_ = value_a;
746
+ return ((("Some" + "(") + ff_core_Show_Show$T.show_(z_.value_)) + ")")
747
+ return
748
+ }
749
+ }
750
+ }
751
+ }
752
+ }}
753
+
754
+ export function ff_core_Equal_Equal$ff_core_Option_Option(ff_core_Equal_Equal$T) { return {
755
+ equals_(x_, y_) {
756
+ {
757
+ const x_a = x_;
758
+ const y_a = y_;
759
+ {
760
+ const _guard1 = (x_ === y_);
761
+ if(_guard1) {
762
+ return true
763
+ return
764
+ }
765
+ }
766
+ {
767
+ if(x_a.Some) {
768
+ const x_ = x_a;
769
+ if(y_a.Some) {
770
+ const y_ = y_a;
771
+ return ff_core_Equal_Equal$T.equals_(x_.value_, y_.value_)
772
+ return
773
+ }
774
+ }
775
+ }
776
+ {
777
+ return false
778
+ return
779
+ }
780
+ }
781
+ },
782
+ async equals_$(x_, y_, $task) {
783
+ {
784
+ const x_a = x_;
785
+ const y_a = y_;
786
+ {
787
+ const _guard1 = (x_ === y_);
788
+ if(_guard1) {
789
+ return true
790
+ return
791
+ }
792
+ }
793
+ {
794
+ if(x_a.Some) {
795
+ const x_ = x_a;
796
+ if(y_a.Some) {
797
+ const y_ = y_a;
798
+ return ff_core_Equal_Equal$T.equals_(x_.value_, y_.value_)
799
+ return
800
+ }
801
+ }
802
+ }
803
+ {
804
+ return false
805
+ return
806
+ }
807
+ }
808
+ }
809
+ }}
810
+
811
+ export function ff_core_Ordering_Order$ff_core_Option_Option(ff_core_Ordering_Order$T) { return {
812
+ compare_(x_, y_) {
813
+ {
814
+ const x_a = x_;
815
+ const y_a = y_;
816
+ {
817
+ const _guard1 = (x_ === y_);
818
+ if(_guard1) {
819
+ return ff_core_Ordering.OrderingSame()
820
+ return
821
+ }
822
+ }
823
+ {
824
+ if(x_a.Some) {
825
+ const x_ = x_a;
826
+ if(y_a.Some) {
827
+ const y_ = y_a;
828
+ const valueOrdering_ = ff_core_Ordering_Order$T.compare_(x_.value_, y_.value_);
829
+ if((valueOrdering_ !== ff_core_Ordering.OrderingSame())) {
830
+ return valueOrdering_
831
+ } else {
832
+ return ff_core_Ordering.OrderingSame()
833
+ }
834
+ return
835
+ }
836
+ }
837
+ }
838
+ {
839
+ function number_(z_) {
840
+ {
841
+ const z_a = z_;
842
+ {
843
+ if(z_a.None) {
844
+ return 0
845
+ return
846
+ }
847
+ }
848
+ {
849
+ if(z_a.Some) {
850
+ return 1
851
+ return
852
+ }
853
+ }
854
+ }
855
+ }
856
+ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
857
+ return
858
+ }
859
+ }
860
+ },
861
+ async compare_$(x_, y_, $task) {
862
+ {
863
+ const x_a = x_;
864
+ const y_a = y_;
865
+ {
866
+ const _guard1 = (x_ === y_);
867
+ if(_guard1) {
868
+ return ff_core_Ordering.OrderingSame()
869
+ return
870
+ }
871
+ }
872
+ {
873
+ if(x_a.Some) {
874
+ const x_ = x_a;
875
+ if(y_a.Some) {
876
+ const y_ = y_a;
877
+ const valueOrdering_ = ff_core_Ordering_Order$T.compare_(x_.value_, y_.value_);
878
+ if((valueOrdering_ !== ff_core_Ordering.OrderingSame())) {
879
+ return valueOrdering_
880
+ } else {
881
+ return ff_core_Ordering.OrderingSame()
882
+ }
883
+ return
884
+ }
885
+ }
886
+ }
887
+ {
888
+ function number_(z_) {
889
+ {
890
+ const z_a = z_;
891
+ {
892
+ if(z_a.None) {
893
+ return 0
894
+ return
895
+ }
896
+ }
897
+ {
898
+ if(z_a.Some) {
899
+ return 1
900
+ return
901
+ }
902
+ }
903
+ }
904
+ }
905
+ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
906
+ return
907
+ }
908
+ }
909
+ }
910
+ }}
911
+
912
+ export function ff_core_Serializable_Serializable$ff_core_Option_Option(ff_core_Serializable_Serializable$T) { return {
913
+ serializeUsing_(serialization_, value_) {
914
+ {
915
+ const serialization_a = serialization_;
916
+ const value_a = value_;
917
+ {
918
+ if(value_a.None) {
919
+ const v_ = value_a;
920
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
921
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
922
+ serialization_.offset_ += 1
923
+ return
924
+ }
925
+ }
926
+ {
927
+ if(value_a.Some) {
928
+ const v_ = value_a;
929
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
930
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
931
+ serialization_.offset_ += 1;
932
+ ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, v_.value_)
933
+ return
934
+ }
935
+ }
936
+ }
937
+ },
938
+ deserializeUsing_(serialization_) {
939
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
940
+ serialization_.offset_ += 1;
941
+ {
942
+ const _1 = variantIndex_;
943
+ {
944
+ if(_1 == 0) {
945
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
946
+ return ff_core_Option.None()
947
+ return
948
+ }
949
+ }
950
+ {
951
+ if(_1 == 1) {
952
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
953
+ return ff_core_Option.Some(ff_core_Serializable_Serializable$T.deserializeUsing_(serialization_))
954
+ return
955
+ }
956
+ }
957
+ {
958
+ 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)})
959
+ return
960
+ }
961
+ }
962
+ },
963
+ async serializeUsing_$(serialization_, value_, $task) {
964
+ {
965
+ const serialization_a = serialization_;
966
+ const value_a = value_;
967
+ {
968
+ if(value_a.None) {
969
+ const v_ = value_a;
970
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
971
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
972
+ serialization_.offset_ += 1
973
+ return
974
+ }
975
+ }
976
+ {
977
+ if(value_a.Some) {
978
+ const v_ = value_a;
979
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
980
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
981
+ serialization_.offset_ += 1;
982
+ ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, v_.value_)
983
+ return
984
+ }
985
+ }
986
+ }
987
+ },
988
+ async deserializeUsing_$(serialization_, $task) {
989
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
990
+ serialization_.offset_ += 1;
991
+ {
992
+ const _1 = variantIndex_;
993
+ {
994
+ if(_1 == 0) {
995
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
996
+ return ff_core_Option.None()
997
+ return
998
+ }
999
+ }
1000
+ {
1001
+ if(_1 == 1) {
1002
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 19), 0);
1003
+ return ff_core_Option.Some(ff_core_Serializable_Serializable$T.deserializeUsing_(serialization_))
1004
+ return
1005
+ }
1006
+ }
1007
+ {
1008
+ 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)})
1009
+ return
1010
+ }
1011
+ }
1012
+ }
1013
+ }}
1014
+
1015
+