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