firefly-compiler 0.4.16 → 0.4.17
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/Compiler.ff +0 -1
- package/compiler/Deriver.ff +3 -3
- package/core/Array.ff +154 -2
- package/core/BrowserSystem.ff +0 -4
- package/core/Int.ff +2 -2
- package/core/IntMap.ff +11 -0
- package/core/List.ff +2 -2
- package/core/Map.ff +11 -0
- package/core/StringMap.ff +11 -0
- package/guide/Main.ff +2 -1
- package/output/js/ff/compiler/Builder.mjs +0 -2
- package/output/js/ff/compiler/Compiler.mjs +1 -3
- package/output/js/ff/compiler/Dependencies.mjs +0 -2
- package/output/js/ff/compiler/Deriver.mjs +4 -6
- package/output/js/ff/compiler/Dictionaries.mjs +0 -2
- package/output/js/ff/compiler/Environment.mjs +0 -2
- package/output/js/ff/compiler/Inference.mjs +0 -2
- package/output/js/ff/compiler/JsEmitter.mjs +0 -2
- package/output/js/ff/compiler/JsImporter.mjs +0 -2
- package/output/js/ff/compiler/LspHook.mjs +0 -2
- package/output/js/ff/compiler/Main.mjs +0 -2
- package/output/js/ff/compiler/Parser.mjs +0 -2
- package/output/js/ff/compiler/Patterns.mjs +0 -2
- package/output/js/ff/compiler/Resolver.mjs +0 -2
- package/output/js/ff/compiler/Substitution.mjs +0 -2
- package/output/js/ff/compiler/Syntax.mjs +0 -2
- package/output/js/ff/compiler/Token.mjs +0 -2
- package/output/js/ff/compiler/Tokenizer.mjs +0 -2
- package/output/js/ff/compiler/Unification.mjs +0 -2
- package/output/js/ff/compiler/Wildcards.mjs +0 -2
- package/output/js/ff/compiler/Workspace.mjs +0 -2
- package/output/js/ff/core/Any.mjs +0 -2
- package/output/js/ff/core/Array.mjs +368 -4
- package/output/js/ff/core/AssetSystem.mjs +0 -2
- package/output/js/ff/core/Atomic.mjs +0 -2
- package/output/js/ff/core/Bool.mjs +0 -2
- package/output/js/ff/core/Box.mjs +0 -2
- package/output/js/ff/core/BrowserSystem.mjs +0 -10
- package/output/js/ff/core/Buffer.mjs +0 -2
- package/output/js/ff/core/BuildSystem.mjs +0 -2
- package/output/js/ff/core/Channel.mjs +0 -2
- package/output/js/ff/core/Char.mjs +0 -2
- package/output/js/ff/core/Core.mjs +0 -2
- package/output/js/ff/core/Duration.mjs +0 -2
- package/output/js/ff/core/Equal.mjs +0 -2
- package/output/js/ff/core/Error.mjs +0 -2
- package/output/js/ff/core/FileHandle.mjs +0 -2
- package/output/js/ff/core/Float.mjs +0 -2
- package/output/js/ff/core/HttpClient.mjs +0 -2
- package/output/js/ff/core/Instant.mjs +0 -2
- package/output/js/ff/core/Int.mjs +4 -6
- package/output/js/ff/core/IntMap.mjs +38 -2
- package/output/js/ff/core/JsSystem.mjs +0 -2
- package/output/js/ff/core/JsValue.mjs +0 -2
- package/output/js/ff/core/Json.mjs +0 -2
- package/output/js/ff/core/List.mjs +4 -6
- package/output/js/ff/core/Lock.mjs +0 -2
- package/output/js/ff/core/Log.mjs +0 -2
- package/output/js/ff/core/Map.mjs +40 -2
- package/output/js/ff/core/NodeSystem.mjs +0 -2
- package/output/js/ff/core/Nothing.mjs +0 -2
- package/output/js/ff/core/Option.mjs +0 -2
- package/output/js/ff/core/Ordering.mjs +0 -2
- package/output/js/ff/core/Pair.mjs +0 -2
- package/output/js/ff/core/Path.mjs +0 -2
- package/output/js/ff/core/Random.mjs +0 -2
- package/output/js/ff/core/RbMap.mjs +0 -2
- package/output/js/ff/core/Serializable.mjs +0 -2
- package/output/js/ff/core/Set.mjs +0 -2
- package/output/js/ff/core/Show.mjs +0 -2
- package/output/js/ff/core/SourceLocation.mjs +0 -2
- package/output/js/ff/core/Stack.mjs +0 -2
- package/output/js/ff/core/Stream.mjs +0 -2
- package/output/js/ff/core/String.mjs +0 -2
- package/output/js/ff/core/StringMap.mjs +38 -2
- package/output/js/ff/core/Task.mjs +0 -2
- package/output/js/ff/core/Try.mjs +0 -2
- package/output/js/ff/core/Unit.mjs +0 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/websocket/.firefly/package.ff +1 -0
- package/{core → websocket}/WebSocket.ff +4 -0
- package/output/js/ff/core/WebSocket.mjs +0 -200
|
@@ -92,8 +92,6 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
92
92
|
|
|
93
93
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
94
94
|
|
|
95
|
-
import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
|
|
96
|
-
|
|
97
95
|
// type Array
|
|
98
96
|
|
|
99
97
|
|
|
@@ -214,7 +212,34 @@ export function Array_dropLast(self_, count_ = 1) {
|
|
|
214
212
|
return self_.slice(0, self_.length - count_)
|
|
215
213
|
}
|
|
216
214
|
|
|
217
|
-
export function
|
|
215
|
+
export function Array_pairs(self_) {
|
|
216
|
+
let i_ = 0;
|
|
217
|
+
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
218
|
+
const r_ = ff_core_Pair.Pair(i_, x_);
|
|
219
|
+
i_ += 1;
|
|
220
|
+
return r_
|
|
221
|
+
}))
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function Array_slice(self_, from_, until_) {
|
|
225
|
+
return ff_core_Array.Array_takeFirst(ff_core_Array.Array_dropFirst(self_, from_), (until_ - from_))
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function Array_foldLeft(self_, initial_, body_) {
|
|
229
|
+
let result_ = initial_;
|
|
230
|
+
ff_core_Array.Array_each(self_, ((x_) => {
|
|
231
|
+
result_ = body_(result_, x_)
|
|
232
|
+
}));
|
|
233
|
+
return result_
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function Array_update(self_, index_, value_) {
|
|
237
|
+
return ff_core_Array.Array_modify(self_, index_, ((_) => {
|
|
238
|
+
return value_
|
|
239
|
+
}))
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function Array_modify(self_, index_, body_) {
|
|
218
243
|
|
|
219
244
|
if(index_ < 0 || index_ >= self_.length) {
|
|
220
245
|
ff_core_Try.internalThrowGrabException_()
|
|
@@ -225,6 +250,22 @@ export function Array_update(self_, index_, body_) {
|
|
|
225
250
|
|
|
226
251
|
}
|
|
227
252
|
|
|
253
|
+
export function Array_zip(self_, that_) {
|
|
254
|
+
if((ff_core_Array.Array_size(self_) <= ff_core_Array.Array_size(that_))) {
|
|
255
|
+
let i_ = (-1);
|
|
256
|
+
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
257
|
+
i_ += 1;
|
|
258
|
+
return ff_core_Pair.Pair(x_, ff_core_Array.Array_grab(that_, i_))
|
|
259
|
+
}))
|
|
260
|
+
} else {
|
|
261
|
+
let i_ = (-1);
|
|
262
|
+
return ff_core_Array.Array_map(that_, ((y_) => {
|
|
263
|
+
i_ += 1;
|
|
264
|
+
return ff_core_Pair.Pair(ff_core_Array.Array_grab(self_, i_), y_)
|
|
265
|
+
}))
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
228
269
|
export function Array_chunk(self_, chunkSize_) {
|
|
229
270
|
const results_ = ff_core_Stack.make_();
|
|
230
271
|
const result_ = ff_core_Stack.make_();
|
|
@@ -307,6 +348,35 @@ return (!result_)
|
|
|
307
348
|
return result_
|
|
308
349
|
}
|
|
309
350
|
|
|
351
|
+
export function Array_find(self_, body_) {
|
|
352
|
+
let result_ = ff_core_Option.None();
|
|
353
|
+
ff_core_Array.Array_eachWhile(self_, ((x_) => {
|
|
354
|
+
if(body_(x_)) {
|
|
355
|
+
result_ = ff_core_Option.Some(x_);
|
|
356
|
+
return false
|
|
357
|
+
} else {
|
|
358
|
+
return true
|
|
359
|
+
}
|
|
360
|
+
}));
|
|
361
|
+
return result_
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export function Array_filter(self_, body_) {
|
|
365
|
+
const result_ = ff_core_Stack.make_();
|
|
366
|
+
ff_core_Array.Array_each(self_, ((x_) => {
|
|
367
|
+
if(body_(x_)) {
|
|
368
|
+
ff_core_Stack.Stack_push(result_, x_)
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
371
|
+
return ff_core_Stack.Stack_drain(result_)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export function Array_partition(self_, body_) {
|
|
375
|
+
return ff_core_Pair.Pair(ff_core_Array.Array_filter(self_, body_), ff_core_Array.Array_filter(self_, ((_w1) => {
|
|
376
|
+
return (!body_(_w1))
|
|
377
|
+
})))
|
|
378
|
+
}
|
|
379
|
+
|
|
310
380
|
export function Array_map(self_, body_) {
|
|
311
381
|
|
|
312
382
|
return self_.map(body_)
|
|
@@ -321,6 +391,38 @@ ff_core_Stack.Stack_pushArray(results_, body_(x_))
|
|
|
321
391
|
return ff_core_Stack.Stack_drain(results_)
|
|
322
392
|
}
|
|
323
393
|
|
|
394
|
+
export function Array_collect(self_, body_) {
|
|
395
|
+
let result_ = ff_core_Stack.make_();
|
|
396
|
+
ff_core_Array.Array_each(self_, ((x_) => {
|
|
397
|
+
ff_core_Option.Option_each(body_(x_), ((_w1) => {
|
|
398
|
+
ff_core_Stack.Stack_push(result_, _w1)
|
|
399
|
+
}))
|
|
400
|
+
}));
|
|
401
|
+
return ff_core_Stack.Stack_drain(result_)
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export function Array_collectFirst(self_, body_) {
|
|
405
|
+
let result_ = ff_core_Option.None();
|
|
406
|
+
ff_core_Array.Array_eachWhile(self_, ((x_) => {
|
|
407
|
+
{
|
|
408
|
+
const _1 = body_(x_);
|
|
409
|
+
{
|
|
410
|
+
if(_1.None) {
|
|
411
|
+
return true
|
|
412
|
+
return
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
{
|
|
416
|
+
const o_ = _1;
|
|
417
|
+
result_ = o_;
|
|
418
|
+
return false
|
|
419
|
+
return
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}));
|
|
423
|
+
return result_
|
|
424
|
+
}
|
|
425
|
+
|
|
324
426
|
export function Array_sortBy(self_, body_, ff_core_Ordering_Order$S) {
|
|
325
427
|
return ff_core_Array.Array_sortWith(self_, ((_w1, _w2) => {
|
|
326
428
|
return ff_core_Ordering_Order$S.compare_(body_(_w1), body_(_w2))
|
|
@@ -333,6 +435,28 @@ ff_core_Stack.Stack_sortWith(stack_, ordering_);
|
|
|
333
435
|
return ff_core_Stack.Stack_drain(stack_)
|
|
334
436
|
}
|
|
335
437
|
|
|
438
|
+
export function Array_reverse(self_) {
|
|
439
|
+
return ff_core_Array.Array_map(ff_core_List.List_toArray(ff_core_Int.Int_to(1, ff_core_Array.Array_size(self_))), ((i_) => {
|
|
440
|
+
return ff_core_Array.Array_grab(self_, (ff_core_Array.Array_size(self_) - i_))
|
|
441
|
+
}))
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export function Array_separate(self_, separator_) {
|
|
445
|
+
const stack_ = ff_core_Stack.make_();
|
|
446
|
+
ff_core_Array.Array_each(ff_core_Array.Array_pairs(self_), ((_1) => {
|
|
447
|
+
{
|
|
448
|
+
const i_ = _1.first_;
|
|
449
|
+
const x_ = _1.second_;
|
|
450
|
+
if((i_ !== 0)) {
|
|
451
|
+
ff_core_Stack.Stack_pushArray(stack_, separator_)
|
|
452
|
+
};
|
|
453
|
+
ff_core_Stack.Stack_push(stack_, x_)
|
|
454
|
+
return
|
|
455
|
+
}
|
|
456
|
+
}));
|
|
457
|
+
return ff_core_Stack.Stack_drain(stack_)
|
|
458
|
+
}
|
|
459
|
+
|
|
336
460
|
export async function Array_addAll$(self_, that_, $task) {
|
|
337
461
|
throw new Error('Function Array_addAll is missing on this target in async context.');
|
|
338
462
|
}
|
|
@@ -385,7 +509,34 @@ export async function Array_dropLast$(self_, count_ = 1, $task) {
|
|
|
385
509
|
throw new Error('Function Array_dropLast is missing on this target in async context.');
|
|
386
510
|
}
|
|
387
511
|
|
|
388
|
-
export async function
|
|
512
|
+
export async function Array_pairs$(self_, $task) {
|
|
513
|
+
let i_ = 0;
|
|
514
|
+
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
515
|
+
const r_ = ff_core_Pair.Pair(i_, x_);
|
|
516
|
+
i_ += 1;
|
|
517
|
+
return r_
|
|
518
|
+
}))
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export async function Array_slice$(self_, from_, until_, $task) {
|
|
522
|
+
return ff_core_Array.Array_takeFirst(ff_core_Array.Array_dropFirst(self_, from_), (until_ - from_))
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export async function Array_foldLeft$(self_, initial_, body_, $task) {
|
|
526
|
+
let result_ = initial_;
|
|
527
|
+
(await ff_core_Array.Array_each$(self_, (async (x_, $task) => {
|
|
528
|
+
result_ = (await body_(result_, x_, $task))
|
|
529
|
+
}), $task));
|
|
530
|
+
return result_
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export async function Array_update$(self_, index_, value_, $task) {
|
|
534
|
+
return ff_core_Array.Array_modify(self_, index_, ((_) => {
|
|
535
|
+
return value_
|
|
536
|
+
}))
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export async function Array_modify$(self_, index_, body_, $task) {
|
|
389
540
|
|
|
390
541
|
if(index_ < 0 || index_ >= self_.length) {
|
|
391
542
|
ff_core_Try.internalThrowGrabException_()
|
|
@@ -396,6 +547,22 @@ export async function Array_update$(self_, index_, body_, $task) {
|
|
|
396
547
|
|
|
397
548
|
}
|
|
398
549
|
|
|
550
|
+
export async function Array_zip$(self_, that_, $task) {
|
|
551
|
+
if((ff_core_Array.Array_size(self_) <= ff_core_Array.Array_size(that_))) {
|
|
552
|
+
let i_ = (-1);
|
|
553
|
+
return ff_core_Array.Array_map(self_, ((x_) => {
|
|
554
|
+
i_ += 1;
|
|
555
|
+
return ff_core_Pair.Pair(x_, ff_core_Array.Array_grab(that_, i_))
|
|
556
|
+
}))
|
|
557
|
+
} else {
|
|
558
|
+
let i_ = (-1);
|
|
559
|
+
return ff_core_Array.Array_map(that_, ((y_) => {
|
|
560
|
+
i_ += 1;
|
|
561
|
+
return ff_core_Pair.Pair(ff_core_Array.Array_grab(self_, i_), y_)
|
|
562
|
+
}))
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
399
566
|
export async function Array_chunk$(self_, chunkSize_, $task) {
|
|
400
567
|
const results_ = ff_core_Stack.make_();
|
|
401
568
|
const result_ = ff_core_Stack.make_();
|
|
@@ -474,6 +641,35 @@ return (!result_)
|
|
|
474
641
|
return result_
|
|
475
642
|
}
|
|
476
643
|
|
|
644
|
+
export async function Array_find$(self_, body_, $task) {
|
|
645
|
+
let result_ = ff_core_Option.None();
|
|
646
|
+
(await ff_core_Array.Array_eachWhile$(self_, (async (x_, $task) => {
|
|
647
|
+
if((await body_(x_, $task))) {
|
|
648
|
+
result_ = ff_core_Option.Some(x_);
|
|
649
|
+
return false
|
|
650
|
+
} else {
|
|
651
|
+
return true
|
|
652
|
+
}
|
|
653
|
+
}), $task));
|
|
654
|
+
return result_
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export async function Array_filter$(self_, body_, $task) {
|
|
658
|
+
const result_ = ff_core_Stack.make_();
|
|
659
|
+
(await ff_core_Array.Array_each$(self_, (async (x_, $task) => {
|
|
660
|
+
if((await body_(x_, $task))) {
|
|
661
|
+
ff_core_Stack.Stack_push(result_, x_)
|
|
662
|
+
}
|
|
663
|
+
}), $task));
|
|
664
|
+
return ff_core_Stack.Stack_drain(result_)
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export async function Array_partition$(self_, body_, $task) {
|
|
668
|
+
return ff_core_Pair.Pair((await ff_core_Array.Array_filter$(self_, body_, $task)), (await ff_core_Array.Array_filter$(self_, (async (_w1, $task) => {
|
|
669
|
+
return (!(await body_(_w1, $task)))
|
|
670
|
+
}), $task)))
|
|
671
|
+
}
|
|
672
|
+
|
|
477
673
|
export async function Array_map$(self_, body_, $task) {
|
|
478
674
|
|
|
479
675
|
let result = [];
|
|
@@ -492,6 +688,38 @@ ff_core_Stack.Stack_pushArray(results_, (await body_(x_, $task)))
|
|
|
492
688
|
return ff_core_Stack.Stack_drain(results_)
|
|
493
689
|
}
|
|
494
690
|
|
|
691
|
+
export async function Array_collect$(self_, body_, $task) {
|
|
692
|
+
let result_ = ff_core_Stack.make_();
|
|
693
|
+
(await ff_core_Array.Array_each$(self_, (async (x_, $task) => {
|
|
694
|
+
ff_core_Option.Option_each((await body_(x_, $task)), ((_w1) => {
|
|
695
|
+
ff_core_Stack.Stack_push(result_, _w1)
|
|
696
|
+
}))
|
|
697
|
+
}), $task));
|
|
698
|
+
return ff_core_Stack.Stack_drain(result_)
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export async function Array_collectFirst$(self_, body_, $task) {
|
|
702
|
+
let result_ = ff_core_Option.None();
|
|
703
|
+
(await ff_core_Array.Array_eachWhile$(self_, (async (x_, $task) => {
|
|
704
|
+
{
|
|
705
|
+
const _1 = (await body_(x_, $task));
|
|
706
|
+
{
|
|
707
|
+
if(_1.None) {
|
|
708
|
+
return true
|
|
709
|
+
return
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
{
|
|
713
|
+
const o_ = _1;
|
|
714
|
+
result_ = o_;
|
|
715
|
+
return false
|
|
716
|
+
return
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}), $task));
|
|
720
|
+
return result_
|
|
721
|
+
}
|
|
722
|
+
|
|
495
723
|
export async function Array_sortBy$(self_, body_, ff_core_Ordering_Order$S, $task) {
|
|
496
724
|
return (await ff_core_Array.Array_sortWith$(self_, (async (_w1, _w2, $task) => {
|
|
497
725
|
return ff_core_Ordering_Order$S.compare_((await body_(_w1, $task)), (await body_(_w2, $task)))
|
|
@@ -504,6 +732,28 @@ const stack_ = ff_core_Array.Array_toStack(self_);
|
|
|
504
732
|
return ff_core_Stack.Stack_drain(stack_)
|
|
505
733
|
}
|
|
506
734
|
|
|
735
|
+
export async function Array_reverse$(self_, $task) {
|
|
736
|
+
return ff_core_Array.Array_map(ff_core_List.List_toArray(ff_core_Int.Int_to(1, ff_core_Array.Array_size(self_))), ((i_) => {
|
|
737
|
+
return ff_core_Array.Array_grab(self_, (ff_core_Array.Array_size(self_) - i_))
|
|
738
|
+
}))
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
export async function Array_separate$(self_, separator_, $task) {
|
|
742
|
+
const stack_ = ff_core_Stack.make_();
|
|
743
|
+
ff_core_Array.Array_each(ff_core_Array.Array_pairs(self_), ((_1) => {
|
|
744
|
+
{
|
|
745
|
+
const i_ = _1.first_;
|
|
746
|
+
const x_ = _1.second_;
|
|
747
|
+
if((i_ !== 0)) {
|
|
748
|
+
ff_core_Stack.Stack_pushArray(stack_, separator_)
|
|
749
|
+
};
|
|
750
|
+
ff_core_Stack.Stack_push(stack_, x_)
|
|
751
|
+
return
|
|
752
|
+
}
|
|
753
|
+
}));
|
|
754
|
+
return ff_core_Stack.Stack_drain(stack_)
|
|
755
|
+
}
|
|
756
|
+
|
|
507
757
|
export function Array_sort(self_, ff_core_Ordering_Order$T) {
|
|
508
758
|
return ff_core_Array.Array_sortWith(self_, ((x_, y_) => {
|
|
509
759
|
return ff_core_Ordering_Order$T.compare_(x_, y_)
|
|
@@ -514,6 +764,25 @@ export function Array_toSet(self_, ff_core_Ordering_Order$T) {
|
|
|
514
764
|
return ff_core_List.List_toSet(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$T)
|
|
515
765
|
}
|
|
516
766
|
|
|
767
|
+
export function Array_distinct(self_, ff_core_Ordering_Order$T) {
|
|
768
|
+
let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
|
|
769
|
+
return ff_core_Array.Array_filter(self_, ((_1) => {
|
|
770
|
+
{
|
|
771
|
+
const item_ = _1;
|
|
772
|
+
const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
|
|
773
|
+
if(_guard1) {
|
|
774
|
+
seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
|
|
775
|
+
return true
|
|
776
|
+
return
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
{
|
|
780
|
+
return false
|
|
781
|
+
return
|
|
782
|
+
}
|
|
783
|
+
}))
|
|
784
|
+
}
|
|
785
|
+
|
|
517
786
|
export async function Array_sort$(self_, ff_core_Ordering_Order$T, $task) {
|
|
518
787
|
return ff_core_Array.Array_sortWith(self_, ((x_, y_) => {
|
|
519
788
|
return ff_core_Ordering_Order$T.compare_(x_, y_)
|
|
@@ -524,14 +793,109 @@ export async function Array_toSet$(self_, ff_core_Ordering_Order$T, $task) {
|
|
|
524
793
|
return ff_core_List.List_toSet(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$T)
|
|
525
794
|
}
|
|
526
795
|
|
|
796
|
+
export async function Array_distinct$(self_, ff_core_Ordering_Order$T, $task) {
|
|
797
|
+
let seen_ = ff_core_List.List_toSet(ff_core_List.Empty(), ff_core_Ordering_Order$T);
|
|
798
|
+
return ff_core_Array.Array_filter(self_, ((_1) => {
|
|
799
|
+
{
|
|
800
|
+
const item_ = _1;
|
|
801
|
+
const _guard1 = (!ff_core_Set.Set_contains(seen_, item_, ff_core_Ordering_Order$T));
|
|
802
|
+
if(_guard1) {
|
|
803
|
+
seen_ = ff_core_Set.Set_add(seen_, item_, ff_core_Ordering_Order$T);
|
|
804
|
+
return true
|
|
805
|
+
return
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
{
|
|
809
|
+
return false
|
|
810
|
+
return
|
|
811
|
+
}
|
|
812
|
+
}))
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
export function Array_flatten(self_) {
|
|
816
|
+
const result_ = ff_core_Stack.make_();
|
|
817
|
+
ff_core_Array.Array_each(self_, ((xs_) => {
|
|
818
|
+
ff_core_Stack.Stack_pushArray(result_, xs_)
|
|
819
|
+
}));
|
|
820
|
+
return ff_core_Stack.Stack_drain(result_)
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
export async function Array_flatten$(self_, $task) {
|
|
824
|
+
const result_ = ff_core_Stack.make_();
|
|
825
|
+
ff_core_Array.Array_each(self_, ((xs_) => {
|
|
826
|
+
ff_core_Stack.Stack_pushArray(result_, xs_)
|
|
827
|
+
}));
|
|
828
|
+
return ff_core_Stack.Stack_drain(result_)
|
|
829
|
+
}
|
|
830
|
+
|
|
527
831
|
export function Array_toMap(self_, ff_core_Ordering_Order$K) {
|
|
528
832
|
return ff_core_List.List_toMap(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$K)
|
|
529
833
|
}
|
|
530
834
|
|
|
835
|
+
export function Array_group(self_, ff_core_Ordering_Order$K) {
|
|
836
|
+
let map_ = ff_core_Map.empty_();
|
|
837
|
+
ff_core_Array.Array_each(self_, ((_1) => {
|
|
838
|
+
{
|
|
839
|
+
const k_ = _1.first_;
|
|
840
|
+
const v_ = _1.second_;
|
|
841
|
+
map_ = ff_core_Map.Map_push(map_, k_, v_, ff_core_Ordering_Order$K)
|
|
842
|
+
return
|
|
843
|
+
}
|
|
844
|
+
}));
|
|
845
|
+
return ff_core_Map.Map_mapValues(map_, ((_, v_) => {
|
|
846
|
+
return ff_core_Stack.Stack_drain(v_)
|
|
847
|
+
}), ff_core_Ordering_Order$K)
|
|
848
|
+
}
|
|
849
|
+
|
|
531
850
|
export async function Array_toMap$(self_, ff_core_Ordering_Order$K, $task) {
|
|
532
851
|
return ff_core_List.List_toMap(ff_core_Array.Array_toList(self_), ff_core_Ordering_Order$K)
|
|
533
852
|
}
|
|
534
853
|
|
|
854
|
+
export async function Array_group$(self_, ff_core_Ordering_Order$K, $task) {
|
|
855
|
+
let map_ = ff_core_Map.empty_();
|
|
856
|
+
ff_core_Array.Array_each(self_, ((_1) => {
|
|
857
|
+
{
|
|
858
|
+
const k_ = _1.first_;
|
|
859
|
+
const v_ = _1.second_;
|
|
860
|
+
map_ = ff_core_Map.Map_push(map_, k_, v_, ff_core_Ordering_Order$K)
|
|
861
|
+
return
|
|
862
|
+
}
|
|
863
|
+
}));
|
|
864
|
+
return ff_core_Map.Map_mapValues(map_, ((_, v_) => {
|
|
865
|
+
return ff_core_Stack.Stack_drain(v_)
|
|
866
|
+
}), ff_core_Ordering_Order$K)
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export function Array_unzip(self_) {
|
|
870
|
+
const first_ = ff_core_Stack.make_();
|
|
871
|
+
const second_ = ff_core_Stack.make_();
|
|
872
|
+
ff_core_Array.Array_each(self_, ((_1) => {
|
|
873
|
+
{
|
|
874
|
+
const x_ = _1.first_;
|
|
875
|
+
const y_ = _1.second_;
|
|
876
|
+
ff_core_Stack.Stack_push(first_, x_);
|
|
877
|
+
ff_core_Stack.Stack_push(second_, y_)
|
|
878
|
+
return
|
|
879
|
+
}
|
|
880
|
+
}));
|
|
881
|
+
return ff_core_Pair.Pair(ff_core_Stack.Stack_drain(first_), ff_core_Stack.Stack_drain(second_))
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
export async function Array_unzip$(self_, $task) {
|
|
885
|
+
const first_ = ff_core_Stack.make_();
|
|
886
|
+
const second_ = ff_core_Stack.make_();
|
|
887
|
+
ff_core_Array.Array_each(self_, ((_1) => {
|
|
888
|
+
{
|
|
889
|
+
const x_ = _1.first_;
|
|
890
|
+
const y_ = _1.second_;
|
|
891
|
+
ff_core_Stack.Stack_push(first_, x_);
|
|
892
|
+
ff_core_Stack.Stack_push(second_, y_)
|
|
893
|
+
return
|
|
894
|
+
}
|
|
895
|
+
}));
|
|
896
|
+
return ff_core_Pair.Pair(ff_core_Stack.Stack_drain(first_), ff_core_Stack.Stack_drain(second_))
|
|
897
|
+
}
|
|
898
|
+
|
|
535
899
|
export function Array_join(self_, separator_ = "") {
|
|
536
900
|
return self_.join(separator_)
|
|
537
901
|
}
|
|
@@ -92,8 +92,6 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
92
92
|
|
|
93
93
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
94
94
|
|
|
95
|
-
import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
|
|
96
|
-
|
|
97
95
|
// type AssetSystem
|
|
98
96
|
export function AssetSystem(files_) {
|
|
99
97
|
return {files_};
|
|
@@ -92,8 +92,6 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
92
92
|
|
|
93
93
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
94
94
|
|
|
95
|
-
import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
|
|
96
|
-
|
|
97
95
|
// type Bool
|
|
98
96
|
const False$ = {False: true};
|
|
99
97
|
export function False() {
|
|
@@ -92,8 +92,6 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
92
92
|
|
|
93
93
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
94
94
|
|
|
95
|
-
import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
|
|
96
|
-
|
|
97
95
|
// type BrowserSystem
|
|
98
96
|
|
|
99
97
|
|
|
@@ -107,10 +105,6 @@ export function BrowserSystem_httpClient(self_) {
|
|
|
107
105
|
throw new Error('Function BrowserSystem_httpClient is missing on this target in sync context.');
|
|
108
106
|
}
|
|
109
107
|
|
|
110
|
-
export function BrowserSystem_webSocket(self_, url_) {
|
|
111
|
-
return ff_core_WebSocket.internalOpenBrowserWebSocket_(self_, url_)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
108
|
export function BrowserSystem_mainTask(self_) {
|
|
115
109
|
throw new Error('Function BrowserSystem_mainTask is missing on this target in sync context.');
|
|
116
110
|
}
|
|
@@ -139,10 +133,6 @@ export async function BrowserSystem_httpClient$(self_, $task) {
|
|
|
139
133
|
return null
|
|
140
134
|
}
|
|
141
135
|
|
|
142
|
-
export async function BrowserSystem_webSocket$(self_, url_, $task) {
|
|
143
|
-
return (await ff_core_WebSocket.internalOpenBrowserWebSocket_$(self_, url_, $task))
|
|
144
|
-
}
|
|
145
|
-
|
|
146
136
|
export async function BrowserSystem_mainTask$(self_, $task) {
|
|
147
137
|
return self_.task_
|
|
148
138
|
}
|
|
@@ -92,8 +92,6 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
92
92
|
|
|
93
93
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
94
94
|
|
|
95
|
-
import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
|
|
96
|
-
|
|
97
95
|
// type GrabException
|
|
98
96
|
const GrabException$ = {GrabException: true};
|
|
99
97
|
export function GrabException() {
|
|
@@ -92,8 +92,6 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
92
92
|
|
|
93
93
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
94
94
|
|
|
95
|
-
import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
|
|
96
|
-
|
|
97
95
|
// type Int
|
|
98
96
|
|
|
99
97
|
|
|
@@ -127,11 +125,11 @@ export function Int_bitXor(self_, that_) {
|
|
|
127
125
|
return self_ ^ that_;
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
export function Int_bitLeft(self_, bits_
|
|
128
|
+
export function Int_bitLeft(self_, bits_) {
|
|
131
129
|
return self_ << bits_;
|
|
132
130
|
}
|
|
133
131
|
|
|
134
|
-
export function Int_bitRight(self_, bits_
|
|
132
|
+
export function Int_bitRight(self_, bits_, signed_ = true) {
|
|
135
133
|
return signed_ ? self_ >> bits_ : self_ >>> bits_;
|
|
136
134
|
}
|
|
137
135
|
|
|
@@ -209,11 +207,11 @@ export async function Int_bitXor$(self_, that_, $task) {
|
|
|
209
207
|
throw new Error('Function Int_bitXor is missing on this target in async context.');
|
|
210
208
|
}
|
|
211
209
|
|
|
212
|
-
export async function Int_bitLeft$(self_, bits_
|
|
210
|
+
export async function Int_bitLeft$(self_, bits_, $task) {
|
|
213
211
|
throw new Error('Function Int_bitLeft is missing on this target in async context.');
|
|
214
212
|
}
|
|
215
213
|
|
|
216
|
-
export async function Int_bitRight$(self_, bits_
|
|
214
|
+
export async function Int_bitRight$(self_, bits_, signed_ = true, $task) {
|
|
217
215
|
throw new Error('Function Int_bitRight is missing on this target in async context.');
|
|
218
216
|
}
|
|
219
217
|
|