firefly-compiler 0.5.9 → 0.5.11
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.
- package/compiler/JsEmitter.ff +95 -0
- package/output/js/ff/compiler/Builder.mjs +22 -16
- package/output/js/ff/compiler/Compiler.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +32 -22
- package/output/js/ff/compiler/JsEmitter.mjs +286 -0
- package/output/js/ff/compiler/LspHook.mjs +2 -2
- package/output/js/ff/compiler/Parser.mjs +84 -82
- package/output/js/ff/compiler/Resolver.mjs +38 -28
- package/output/js/ff/compiler/Tokenizer.mjs +10 -10
- package/output/js/ff/compiler/Unification.mjs +10 -8
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/Int.mjs +4 -4
- package/output/js/ff/core/IntMap.mjs +8 -8
- package/output/js/ff/core/Json.mjs +12 -10
- package/output/js/ff/core/List.mjs +130 -104
- package/output/js/ff/core/Map.mjs +8 -6
- package/output/js/ff/core/Random.mjs +18 -12
- package/output/js/ff/core/RbMap.mjs +2 -2
- package/output/js/ff/core/Serializable.mjs +6 -4
- package/output/js/ff/core/Set.mjs +6 -4
- package/output/js/ff/core/Stream.mjs +8 -8
- package/output/js/ff/core/StringMap.mjs +8 -8
- package/output/js/ff/core/Task.mjs +6 -4
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -243,7 +243,7 @@ export function List_takeWhile(self_, body_) {
|
|
|
243
243
|
const result_ = ff_core_Array.new_();
|
|
244
244
|
let i_ = 0;
|
|
245
245
|
while(((i_ < ff_core_List.List_size(self_)) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
|
|
246
|
-
|
|
246
|
+
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
247
247
|
i_ += 1
|
|
248
248
|
};
|
|
249
249
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -256,7 +256,7 @@ while(((i_ < ff_core_List.List_size(self_)) && body_((self_[i_] ?? ff_core_List.
|
|
|
256
256
|
i_ += 1
|
|
257
257
|
};
|
|
258
258
|
while((i_ < ff_core_List.List_size(self_))) {
|
|
259
|
-
|
|
259
|
+
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
260
260
|
i_ += 1
|
|
261
261
|
};
|
|
262
262
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -267,11 +267,11 @@ const first_ = ff_core_Array.new_();
|
|
|
267
267
|
const second_ = ff_core_Array.new_();
|
|
268
268
|
let i_ = 0;
|
|
269
269
|
while(((i_ < ff_core_List.List_size(self_)) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
|
|
270
|
-
|
|
270
|
+
first_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
271
271
|
i_ += 1
|
|
272
272
|
};
|
|
273
273
|
while((i_ < ff_core_List.List_size(self_))) {
|
|
274
|
-
|
|
274
|
+
second_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
275
275
|
i_ += 1
|
|
276
276
|
};
|
|
277
277
|
return ff_core_Pair.Pair(ff_core_Array.Array_drain(first_), ff_core_Array.Array_drain(second_))
|
|
@@ -292,9 +292,10 @@ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (u
|
|
|
292
292
|
|
|
293
293
|
export function List_foldLeft(self_, initial_, body_) {
|
|
294
294
|
let result_ = initial_;
|
|
295
|
-
|
|
295
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
296
|
+
const x_ = for_a[for_i];
|
|
296
297
|
result_ = body_(result_, x_)
|
|
297
|
-
}
|
|
298
|
+
};
|
|
298
299
|
return result_
|
|
299
300
|
}
|
|
300
301
|
|
|
@@ -335,17 +336,18 @@ export function List_chunk(self_, chunkSize_) {
|
|
|
335
336
|
const results_ = ff_core_Array.new_();
|
|
336
337
|
const result_ = ff_core_Array.new_();
|
|
337
338
|
let added_ = 0;
|
|
338
|
-
|
|
339
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
340
|
+
const item_ = for_a[for_i];
|
|
339
341
|
if((added_ < chunkSize_)) {
|
|
340
342
|
added_ += 1
|
|
341
343
|
} else {
|
|
342
|
-
|
|
344
|
+
results_.array.push(ff_core_Array.Array_drain(result_));
|
|
343
345
|
added_ = 1
|
|
344
346
|
};
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
+
result_.array.push(item_)
|
|
348
|
+
};
|
|
347
349
|
if((added_ !== 0)) {
|
|
348
|
-
|
|
350
|
+
results_.array.push(ff_core_Array.Array_drain(result_))
|
|
349
351
|
};
|
|
350
352
|
return ff_core_Array.Array_drain(results_)
|
|
351
353
|
}
|
|
@@ -387,57 +389,64 @@ for(const value of self_) if(!body_(value)) break
|
|
|
387
389
|
|
|
388
390
|
export function List_all(self_, body_) {
|
|
389
391
|
let result_ = true;
|
|
390
|
-
|
|
392
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
393
|
+
const x_ = for_a[for_i];
|
|
391
394
|
result_ = (result_ && body_(x_));
|
|
392
|
-
|
|
393
|
-
}
|
|
395
|
+
if(!result_) break
|
|
396
|
+
};
|
|
394
397
|
return result_
|
|
395
398
|
}
|
|
396
399
|
|
|
397
400
|
export function List_any(self_, body_) {
|
|
398
401
|
let result_ = false;
|
|
399
|
-
|
|
402
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
403
|
+
const x_ = for_a[for_i];
|
|
400
404
|
result_ = (result_ || body_(x_));
|
|
401
|
-
|
|
402
|
-
}
|
|
405
|
+
if(!(!result_)) break
|
|
406
|
+
};
|
|
403
407
|
return result_
|
|
404
408
|
}
|
|
405
409
|
|
|
406
410
|
export function List_indexWhere(self_, body_) {
|
|
407
411
|
let result_ = ff_core_Option.None();
|
|
408
412
|
let i_ = 0;
|
|
409
|
-
|
|
410
|
-
|
|
413
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
414
|
+
const x_ = for_a[for_i];
|
|
415
|
+
if(!(body_(x_)
|
|
416
|
+
? (function() {
|
|
411
417
|
result_ = ff_core_Option.Some(i_);
|
|
412
418
|
return false
|
|
413
|
-
}
|
|
419
|
+
})()
|
|
420
|
+
: (function() {
|
|
414
421
|
i_ += 1;
|
|
415
422
|
return true
|
|
416
|
-
}
|
|
417
|
-
}
|
|
423
|
+
})())) break
|
|
424
|
+
};
|
|
418
425
|
return result_
|
|
419
426
|
}
|
|
420
427
|
|
|
421
428
|
export function List_find(self_, body_) {
|
|
422
429
|
let result_ = ff_core_Option.None();
|
|
423
|
-
|
|
424
|
-
|
|
430
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
431
|
+
const x_ = for_a[for_i];
|
|
432
|
+
if(!(body_(x_)
|
|
433
|
+
? (function() {
|
|
425
434
|
result_ = ff_core_Option.Some(x_);
|
|
426
435
|
return false
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
}));
|
|
436
|
+
})()
|
|
437
|
+
: true)) break
|
|
438
|
+
};
|
|
431
439
|
return result_
|
|
432
440
|
}
|
|
433
441
|
|
|
434
442
|
export function List_filter(self_, body_) {
|
|
435
443
|
const result_ = ff_core_Array.new_();
|
|
436
|
-
|
|
444
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
445
|
+
const x_ = for_a[for_i];
|
|
437
446
|
if(body_(x_)) {
|
|
438
|
-
|
|
447
|
+
result_.array.push(x_)
|
|
439
448
|
}
|
|
440
|
-
}
|
|
449
|
+
};
|
|
441
450
|
return ff_core_Array.Array_drain(result_)
|
|
442
451
|
}
|
|
443
452
|
|
|
@@ -455,27 +464,29 @@ export function List_map(self_, body_) {
|
|
|
455
464
|
|
|
456
465
|
export function List_flatMap(self_, body_) {
|
|
457
466
|
const results_ = ff_core_Array.new_();
|
|
458
|
-
|
|
467
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
468
|
+
const x_ = for_a[for_i];
|
|
459
469
|
ff_core_Array.Array_pushList(results_, body_(x_))
|
|
460
|
-
}
|
|
470
|
+
};
|
|
461
471
|
return ff_core_Array.Array_drain(results_)
|
|
462
472
|
}
|
|
463
473
|
|
|
464
474
|
export function List_collect(self_, body_) {
|
|
465
475
|
let result_ = ff_core_Array.new_();
|
|
466
|
-
|
|
476
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
477
|
+
const x_ = for_a[for_i];
|
|
467
478
|
ff_core_Option.Option_each(body_(x_), ((_w1) => {
|
|
468
|
-
|
|
479
|
+
result_.array.push(_w1)
|
|
469
480
|
}))
|
|
470
|
-
}
|
|
481
|
+
};
|
|
471
482
|
return ff_core_Array.Array_drain(result_)
|
|
472
483
|
}
|
|
473
484
|
|
|
474
485
|
export function List_collectFirst(self_, body_) {
|
|
475
486
|
let result_ = ff_core_Option.None();
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
487
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
488
|
+
const x_ = for_a[for_i];
|
|
489
|
+
if(!(((_1) => {
|
|
479
490
|
if(_1.None) {
|
|
480
491
|
return true
|
|
481
492
|
}
|
|
@@ -484,8 +495,8 @@ const o_ = _1;
|
|
|
484
495
|
result_ = o_;
|
|
485
496
|
return false
|
|
486
497
|
}
|
|
487
|
-
}
|
|
488
|
-
}
|
|
498
|
+
}))(body_(x_))) break
|
|
499
|
+
};
|
|
489
500
|
return result_
|
|
490
501
|
}
|
|
491
502
|
|
|
@@ -516,7 +527,7 @@ const x_ = _1.second_;
|
|
|
516
527
|
if((i_ !== 0)) {
|
|
517
528
|
ff_core_Array.Array_pushList(array_, separator_)
|
|
518
529
|
};
|
|
519
|
-
|
|
530
|
+
array_.array.push(x_)
|
|
520
531
|
return
|
|
521
532
|
}
|
|
522
533
|
}));
|
|
@@ -599,7 +610,7 @@ export async function List_takeWhile$(self_, body_, $task) {
|
|
|
599
610
|
const result_ = ff_core_Array.new_();
|
|
600
611
|
let i_ = 0;
|
|
601
612
|
while(((i_ < ff_core_List.List_size(self_)) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
|
|
602
|
-
|
|
613
|
+
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
603
614
|
i_ += 1
|
|
604
615
|
};
|
|
605
616
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -612,7 +623,7 @@ while(((i_ < ff_core_List.List_size(self_)) && (await body_((self_[i_] ?? ff_cor
|
|
|
612
623
|
i_ += 1
|
|
613
624
|
};
|
|
614
625
|
while((i_ < ff_core_List.List_size(self_))) {
|
|
615
|
-
|
|
626
|
+
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
616
627
|
i_ += 1
|
|
617
628
|
};
|
|
618
629
|
return ff_core_Array.Array_drain(result_)
|
|
@@ -623,11 +634,11 @@ const first_ = ff_core_Array.new_();
|
|
|
623
634
|
const second_ = ff_core_Array.new_();
|
|
624
635
|
let i_ = 0;
|
|
625
636
|
while(((i_ < ff_core_List.List_size(self_)) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
|
|
626
|
-
|
|
637
|
+
first_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
627
638
|
i_ += 1
|
|
628
639
|
};
|
|
629
640
|
while((i_ < ff_core_List.List_size(self_))) {
|
|
630
|
-
|
|
641
|
+
second_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
631
642
|
i_ += 1
|
|
632
643
|
};
|
|
633
644
|
return ff_core_Pair.Pair(ff_core_Array.Array_drain(first_), ff_core_Array.Array_drain(second_))
|
|
@@ -648,9 +659,10 @@ return ff_core_List.List_takeFirst(ff_core_List.List_dropFirst(self_, from_), (u
|
|
|
648
659
|
|
|
649
660
|
export async function List_foldLeft$(self_, initial_, body_, $task) {
|
|
650
661
|
let result_ = initial_;
|
|
651
|
-
(
|
|
662
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
663
|
+
const x_ = for_a[for_i];
|
|
652
664
|
result_ = (await body_(result_, x_, $task))
|
|
653
|
-
}
|
|
665
|
+
};
|
|
654
666
|
return result_
|
|
655
667
|
}
|
|
656
668
|
|
|
@@ -691,17 +703,18 @@ export async function List_chunk$(self_, chunkSize_, $task) {
|
|
|
691
703
|
const results_ = ff_core_Array.new_();
|
|
692
704
|
const result_ = ff_core_Array.new_();
|
|
693
705
|
let added_ = 0;
|
|
694
|
-
|
|
706
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
707
|
+
const item_ = for_a[for_i];
|
|
695
708
|
if((added_ < chunkSize_)) {
|
|
696
709
|
added_ += 1
|
|
697
710
|
} else {
|
|
698
|
-
|
|
711
|
+
results_.array.push(ff_core_Array.Array_drain(result_));
|
|
699
712
|
added_ = 1
|
|
700
713
|
};
|
|
701
|
-
|
|
702
|
-
}
|
|
714
|
+
result_.array.push(item_)
|
|
715
|
+
};
|
|
703
716
|
if((added_ !== 0)) {
|
|
704
|
-
|
|
717
|
+
results_.array.push(ff_core_Array.Array_drain(result_))
|
|
705
718
|
};
|
|
706
719
|
return ff_core_Array.Array_drain(results_)
|
|
707
720
|
}
|
|
@@ -745,57 +758,64 @@ for(const value of self_) if(!await body_(value, $task)) break
|
|
|
745
758
|
|
|
746
759
|
export async function List_all$(self_, body_, $task) {
|
|
747
760
|
let result_ = true;
|
|
748
|
-
(
|
|
761
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
762
|
+
const x_ = for_a[for_i];
|
|
749
763
|
result_ = (result_ && (await body_(x_, $task)));
|
|
750
|
-
|
|
751
|
-
}
|
|
764
|
+
if(!result_) break
|
|
765
|
+
};
|
|
752
766
|
return result_
|
|
753
767
|
}
|
|
754
768
|
|
|
755
769
|
export async function List_any$(self_, body_, $task) {
|
|
756
770
|
let result_ = false;
|
|
757
|
-
(
|
|
771
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
772
|
+
const x_ = for_a[for_i];
|
|
758
773
|
result_ = (result_ || (await body_(x_, $task)));
|
|
759
|
-
|
|
760
|
-
}
|
|
774
|
+
if(!(!result_)) break
|
|
775
|
+
};
|
|
761
776
|
return result_
|
|
762
777
|
}
|
|
763
778
|
|
|
764
779
|
export async function List_indexWhere$(self_, body_, $task) {
|
|
765
780
|
let result_ = ff_core_Option.None();
|
|
766
781
|
let i_ = 0;
|
|
767
|
-
(
|
|
768
|
-
|
|
782
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
783
|
+
const x_ = for_a[for_i];
|
|
784
|
+
if(!((await body_(x_, $task))
|
|
785
|
+
? (await (async function() {
|
|
769
786
|
result_ = ff_core_Option.Some(i_);
|
|
770
787
|
return false
|
|
771
|
-
}
|
|
788
|
+
})())
|
|
789
|
+
: (await (async function() {
|
|
772
790
|
i_ += 1;
|
|
773
791
|
return true
|
|
774
|
-
}
|
|
775
|
-
}
|
|
792
|
+
})()))) break
|
|
793
|
+
};
|
|
776
794
|
return result_
|
|
777
795
|
}
|
|
778
796
|
|
|
779
797
|
export async function List_find$(self_, body_, $task) {
|
|
780
798
|
let result_ = ff_core_Option.None();
|
|
781
|
-
(
|
|
782
|
-
|
|
799
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
800
|
+
const x_ = for_a[for_i];
|
|
801
|
+
if(!((await body_(x_, $task))
|
|
802
|
+
? (await (async function() {
|
|
783
803
|
result_ = ff_core_Option.Some(x_);
|
|
784
804
|
return false
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
}
|
|
788
|
-
}), $task));
|
|
805
|
+
})())
|
|
806
|
+
: true)) break
|
|
807
|
+
};
|
|
789
808
|
return result_
|
|
790
809
|
}
|
|
791
810
|
|
|
792
811
|
export async function List_filter$(self_, body_, $task) {
|
|
793
812
|
const result_ = ff_core_Array.new_();
|
|
794
|
-
(
|
|
813
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
814
|
+
const x_ = for_a[for_i];
|
|
795
815
|
if((await body_(x_, $task))) {
|
|
796
|
-
|
|
816
|
+
result_.array.push(x_)
|
|
797
817
|
}
|
|
798
|
-
}
|
|
818
|
+
};
|
|
799
819
|
return ff_core_Array.Array_drain(result_)
|
|
800
820
|
}
|
|
801
821
|
|
|
@@ -817,27 +837,29 @@ export async function List_map$(self_, body_, $task) {
|
|
|
817
837
|
|
|
818
838
|
export async function List_flatMap$(self_, body_, $task) {
|
|
819
839
|
const results_ = ff_core_Array.new_();
|
|
820
|
-
(
|
|
840
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
841
|
+
const x_ = for_a[for_i];
|
|
821
842
|
ff_core_Array.Array_pushList(results_, (await body_(x_, $task)))
|
|
822
|
-
}
|
|
843
|
+
};
|
|
823
844
|
return ff_core_Array.Array_drain(results_)
|
|
824
845
|
}
|
|
825
846
|
|
|
826
847
|
export async function List_collect$(self_, body_, $task) {
|
|
827
848
|
let result_ = ff_core_Array.new_();
|
|
828
|
-
(
|
|
849
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
850
|
+
const x_ = for_a[for_i];
|
|
829
851
|
ff_core_Option.Option_each((await body_(x_, $task)), ((_w1) => {
|
|
830
|
-
|
|
852
|
+
result_.array.push(_w1)
|
|
831
853
|
}))
|
|
832
|
-
}
|
|
854
|
+
};
|
|
833
855
|
return ff_core_Array.Array_drain(result_)
|
|
834
856
|
}
|
|
835
857
|
|
|
836
858
|
export async function List_collectFirst$(self_, body_, $task) {
|
|
837
859
|
let result_ = ff_core_Option.None();
|
|
838
|
-
(
|
|
839
|
-
|
|
840
|
-
|
|
860
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
861
|
+
const x_ = for_a[for_i];
|
|
862
|
+
if(!(((_1) => {
|
|
841
863
|
if(_1.None) {
|
|
842
864
|
return true
|
|
843
865
|
}
|
|
@@ -846,8 +868,8 @@ const o_ = _1;
|
|
|
846
868
|
result_ = o_;
|
|
847
869
|
return false
|
|
848
870
|
}
|
|
849
|
-
}
|
|
850
|
-
}
|
|
871
|
+
}))((await body_(x_, $task)))) break
|
|
872
|
+
};
|
|
851
873
|
return result_
|
|
852
874
|
}
|
|
853
875
|
|
|
@@ -878,7 +900,7 @@ const x_ = _1.second_;
|
|
|
878
900
|
if((i_ !== 0)) {
|
|
879
901
|
ff_core_Array.Array_pushList(array_, separator_)
|
|
880
902
|
};
|
|
881
|
-
|
|
903
|
+
array_.array.push(x_)
|
|
882
904
|
return
|
|
883
905
|
}
|
|
884
906
|
}));
|
|
@@ -943,17 +965,19 @@ return false
|
|
|
943
965
|
|
|
944
966
|
export function List_flatten(self_) {
|
|
945
967
|
const result_ = ff_core_Array.new_();
|
|
946
|
-
|
|
968
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
969
|
+
const xs_ = for_a[for_i];
|
|
947
970
|
ff_core_Array.Array_pushList(result_, xs_)
|
|
948
|
-
}
|
|
971
|
+
};
|
|
949
972
|
return ff_core_Array.Array_drain(result_)
|
|
950
973
|
}
|
|
951
974
|
|
|
952
975
|
export async function List_flatten$(self_, $task) {
|
|
953
976
|
const result_ = ff_core_Array.new_();
|
|
954
|
-
|
|
977
|
+
for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
978
|
+
const xs_ = for_a[for_i];
|
|
955
979
|
ff_core_Array.Array_pushList(result_, xs_)
|
|
956
|
-
}
|
|
980
|
+
};
|
|
957
981
|
return ff_core_Array.Array_drain(result_)
|
|
958
982
|
}
|
|
959
983
|
|
|
@@ -1016,8 +1040,8 @@ ff_core_List.List_each(self_, ((_1) => {
|
|
|
1016
1040
|
{
|
|
1017
1041
|
const x_ = _1.first_;
|
|
1018
1042
|
const y_ = _1.second_;
|
|
1019
|
-
|
|
1020
|
-
|
|
1043
|
+
first_.array.push(x_);
|
|
1044
|
+
second_.array.push(y_)
|
|
1021
1045
|
return
|
|
1022
1046
|
}
|
|
1023
1047
|
}));
|
|
@@ -1031,8 +1055,8 @@ ff_core_List.List_each(self_, ((_1) => {
|
|
|
1031
1055
|
{
|
|
1032
1056
|
const x_ = _1.first_;
|
|
1033
1057
|
const y_ = _1.second_;
|
|
1034
|
-
|
|
1035
|
-
|
|
1058
|
+
first_.array.push(x_);
|
|
1059
|
+
second_.array.push(y_)
|
|
1036
1060
|
return
|
|
1037
1061
|
}
|
|
1038
1062
|
}));
|
|
@@ -1050,26 +1074,28 @@ throw new Error('Function List_join is missing on this target in async context.'
|
|
|
1050
1074
|
export function ff_core_Show_Show$ff_core_List_List(ff_core_Show_Show$T) { return {
|
|
1051
1075
|
show_(value_) {
|
|
1052
1076
|
const array_ = ff_core_Array.new_();
|
|
1053
|
-
|
|
1054
|
-
|
|
1077
|
+
array_.array.push("[");
|
|
1078
|
+
for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1079
|
+
const x_ = for_a[for_i];
|
|
1055
1080
|
if((ff_core_Array.Array_size(array_) > 1)) {
|
|
1056
|
-
|
|
1081
|
+
array_.array.push(", ")
|
|
1057
1082
|
};
|
|
1058
|
-
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1083
|
+
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
1084
|
+
};
|
|
1085
|
+
array_.array.push("]");
|
|
1061
1086
|
return ff_core_Array.Array_join(array_, "")
|
|
1062
1087
|
},
|
|
1063
1088
|
async show_$(value_, $task) {
|
|
1064
1089
|
const array_ = ff_core_Array.new_();
|
|
1065
|
-
|
|
1066
|
-
|
|
1090
|
+
array_.array.push("[");
|
|
1091
|
+
for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1092
|
+
const x_ = for_a[for_i];
|
|
1067
1093
|
if((ff_core_Array.Array_size(array_) > 1)) {
|
|
1068
|
-
|
|
1094
|
+
array_.array.push(", ")
|
|
1069
1095
|
};
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1096
|
+
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
1097
|
+
};
|
|
1098
|
+
array_.array.push("]");
|
|
1073
1099
|
return ff_core_Array.Array_join(array_, "")
|
|
1074
1100
|
}
|
|
1075
1101
|
}}
|
|
@@ -149,9 +149,10 @@ return result_
|
|
|
149
149
|
|
|
150
150
|
export function Map_removeList(self_, keys_, ff_core_Ordering_Order$K) {
|
|
151
151
|
let result_ = self_;
|
|
152
|
-
|
|
152
|
+
for(let for_i = 0, for_a = keys_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
153
|
+
const k_ = for_a[for_i];
|
|
153
154
|
result_ = ff_core_RbMap.delete_(k_, result_, ff_core_Ordering_Order$K)
|
|
154
|
-
}
|
|
155
|
+
};
|
|
155
156
|
return result_
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -267,9 +268,10 @@ return result_
|
|
|
267
268
|
|
|
268
269
|
export async function Map_removeList$(self_, keys_, ff_core_Ordering_Order$K, $task) {
|
|
269
270
|
let result_ = self_;
|
|
270
|
-
|
|
271
|
+
for(let for_i = 0, for_a = keys_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
272
|
+
const k_ = for_a[for_i];
|
|
271
273
|
result_ = ff_core_RbMap.delete_(k_, result_, ff_core_Ordering_Order$K)
|
|
272
|
-
}
|
|
274
|
+
};
|
|
273
275
|
return result_
|
|
274
276
|
}
|
|
275
277
|
|
|
@@ -366,7 +368,7 @@ return ff_core_Map.Map_add(self_, key_, ff_core_List.List_toArray([value_]), ff_
|
|
|
366
368
|
}
|
|
367
369
|
if(_1.Some) {
|
|
368
370
|
const array_ = _1.value_;
|
|
369
|
-
|
|
371
|
+
array_.array.push(value_);
|
|
370
372
|
return self_
|
|
371
373
|
}
|
|
372
374
|
}
|
|
@@ -380,7 +382,7 @@ return ff_core_Map.Map_add(self_, key_, ff_core_List.List_toArray([value_]), ff_
|
|
|
380
382
|
}
|
|
381
383
|
if(_1.Some) {
|
|
382
384
|
const array_ = _1.value_;
|
|
383
|
-
|
|
385
|
+
array_.array.push(value_);
|
|
384
386
|
return self_
|
|
385
387
|
}
|
|
386
388
|
}
|
|
@@ -190,9 +190,10 @@ return (ff_core_Random.Random_nextInt(self_, 0, 2) === 0)
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
export function Random_nextBytes(self_, buffer_, start_, stop_) {
|
|
193
|
-
|
|
193
|
+
for(let for_i = start_, for_e = stop_; for_i < for_e; for_i++) {
|
|
194
|
+
const i_ = for_i;
|
|
194
195
|
ff_core_Buffer.Buffer_setUint8(buffer_, i_, ff_core_Random.Random_nextInt(self_, 0, 256))
|
|
195
|
-
}
|
|
196
|
+
}
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
export function Random_nextGauss(self_, mean_, standardDeviation_) {
|
|
@@ -216,12 +217,13 @@ export function Random_nextGauss(self_, mean_, standardDeviation_) {
|
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
export function Random_shuffleArray(self_, array_) {
|
|
219
|
-
|
|
220
|
+
for(let for_i = 0, for_e = (ff_core_Array.Array_size(array_) - 1); for_i < for_e; for_i++) {
|
|
221
|
+
const i_ = for_i;
|
|
220
222
|
const j_ = (ff_core_Random.Random_nextInt(self_, 0, (ff_core_Array.Array_size(array_) - i_)) + i_);
|
|
221
223
|
const value_ = (array_.array[i_] ?? ff_core_Array.internalGrab_(array_, i_));
|
|
222
224
|
ff_core_Array.Array_set(array_, i_, (array_.array[j_] ?? ff_core_Array.internalGrab_(array_, j_)));
|
|
223
225
|
ff_core_Array.Array_set(array_, j_, value_)
|
|
224
|
-
}
|
|
226
|
+
}
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
export function Random_shuffleList(self_, list_) {
|
|
@@ -231,9 +233,10 @@ return ff_core_Array.Array_drain(array_)
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
export function Random_sampleArray(self_, count_, array_, body_) {
|
|
234
|
-
|
|
236
|
+
for(let for_i = 0, for_a = ff_core_Random.Random_shuffleList(self_, ff_core_Array.Array_toList(array_, 0, 9007199254740991)), for_l = Math.min(Math.max(count_, 0), for_a.length); for_i < for_l; for_i++) {
|
|
237
|
+
const _w1 = for_a[for_i];
|
|
235
238
|
body_(_w1)
|
|
236
|
-
}
|
|
239
|
+
}
|
|
237
240
|
}
|
|
238
241
|
|
|
239
242
|
export function Random_sampleList(self_, count_, list_) {
|
|
@@ -265,9 +268,10 @@ return (ff_core_Random.Random_nextInt(self_, 0, 2) === 0)
|
|
|
265
268
|
}
|
|
266
269
|
|
|
267
270
|
export async function Random_nextBytes$(self_, buffer_, start_, stop_, $task) {
|
|
268
|
-
|
|
271
|
+
for(let for_i = start_, for_e = stop_; for_i < for_e; for_i++) {
|
|
272
|
+
const i_ = for_i;
|
|
269
273
|
ff_core_Buffer.Buffer_setUint8(buffer_, i_, ff_core_Random.Random_nextInt(self_, 0, 256))
|
|
270
|
-
}
|
|
274
|
+
}
|
|
271
275
|
}
|
|
272
276
|
|
|
273
277
|
export async function Random_nextGauss$(self_, mean_, standardDeviation_, $task) {
|
|
@@ -275,12 +279,13 @@ throw new Error('Function Random_nextGauss is missing on this target in async co
|
|
|
275
279
|
}
|
|
276
280
|
|
|
277
281
|
export async function Random_shuffleArray$(self_, array_, $task) {
|
|
278
|
-
|
|
282
|
+
for(let for_i = 0, for_e = (ff_core_Array.Array_size(array_) - 1); for_i < for_e; for_i++) {
|
|
283
|
+
const i_ = for_i;
|
|
279
284
|
const j_ = (ff_core_Random.Random_nextInt(self_, 0, (ff_core_Array.Array_size(array_) - i_)) + i_);
|
|
280
285
|
const value_ = (array_.array[i_] ?? ff_core_Array.internalGrab_(array_, i_));
|
|
281
286
|
ff_core_Array.Array_set(array_, i_, (array_.array[j_] ?? ff_core_Array.internalGrab_(array_, j_)));
|
|
282
287
|
ff_core_Array.Array_set(array_, j_, value_)
|
|
283
|
-
}
|
|
288
|
+
}
|
|
284
289
|
}
|
|
285
290
|
|
|
286
291
|
export async function Random_shuffleList$(self_, list_, $task) {
|
|
@@ -290,9 +295,10 @@ return ff_core_Array.Array_drain(array_)
|
|
|
290
295
|
}
|
|
291
296
|
|
|
292
297
|
export async function Random_sampleArray$(self_, count_, array_, body_, $task) {
|
|
293
|
-
(
|
|
298
|
+
for(let for_i = 0, for_a = ff_core_Random.Random_shuffleList(self_, ff_core_Array.Array_toList(array_, 0, 9007199254740991)), for_l = Math.min(Math.max(count_, 0), for_a.length); for_i < for_l; for_i++) {
|
|
299
|
+
const _w1 = for_a[for_i];
|
|
294
300
|
(await body_(_w1, $task))
|
|
295
|
-
}
|
|
301
|
+
}
|
|
296
302
|
}
|
|
297
303
|
|
|
298
304
|
export async function Random_sampleList$(self_, count_, list_, $task) {
|
|
@@ -1010,7 +1010,7 @@ return ((ff_core_RbMap.RB_size(l_, ff_core_Ordering_Order$K) + 1) + ff_core_RbMa
|
|
|
1010
1010
|
export function RB_pairs(self_, ff_core_Ordering_Order$K) {
|
|
1011
1011
|
const result_ = ff_core_List.List_toArray([]);
|
|
1012
1012
|
ff_core_RbMap.RB_each(self_, ((k_, v_) => {
|
|
1013
|
-
|
|
1013
|
+
result_.array.push(ff_core_Pair.Pair(k_, v_))
|
|
1014
1014
|
}), ff_core_Ordering_Order$K);
|
|
1015
1015
|
return ff_core_Array.Array_drain(result_)
|
|
1016
1016
|
}
|
|
@@ -1203,7 +1203,7 @@ return ((ff_core_RbMap.RB_size(l_, ff_core_Ordering_Order$K) + 1) + ff_core_RbMa
|
|
|
1203
1203
|
export async function RB_pairs$(self_, ff_core_Ordering_Order$K, $task) {
|
|
1204
1204
|
const result_ = ff_core_List.List_toArray([]);
|
|
1205
1205
|
ff_core_RbMap.RB_each(self_, ((k_, v_) => {
|
|
1206
|
-
|
|
1206
|
+
result_.array.push(ff_core_Pair.Pair(k_, v_))
|
|
1207
1207
|
}), ff_core_Ordering_Order$K);
|
|
1208
1208
|
return ff_core_Array.Array_drain(result_)
|
|
1209
1209
|
}
|
|
@@ -251,9 +251,10 @@ serialization_.offset_ += (1 + 4)
|
|
|
251
251
|
} else {
|
|
252
252
|
ff_core_Core.panic_("Can't serialize arrays where size() >= 1073741824")
|
|
253
253
|
};
|
|
254
|
-
|
|
254
|
+
for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
255
|
+
const _w1 = for_a[for_i];
|
|
255
256
|
ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, _w1)
|
|
256
|
-
}
|
|
257
|
+
}
|
|
257
258
|
},
|
|
258
259
|
deserializeUsing_(serialization_) {
|
|
259
260
|
const smallSize_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
|
|
@@ -293,9 +294,10 @@ serialization_.offset_ += (1 + 4)
|
|
|
293
294
|
} else {
|
|
294
295
|
ff_core_Core.panic_("Can't serialize arrays where size() >= 1073741824")
|
|
295
296
|
};
|
|
296
|
-
|
|
297
|
+
for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
298
|
+
const _w1 = for_a[for_i];
|
|
297
299
|
ff_core_Serializable_Serializable$T.serializeUsing_(serialization_, _w1)
|
|
298
|
-
}
|
|
300
|
+
}
|
|
299
301
|
},
|
|
300
302
|
async deserializeUsing_$(serialization_, $task) {
|
|
301
303
|
const smallSize_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
|