firefly-compiler 0.5.12 → 0.5.14
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 +19 -7
- package/output/js/ff/compiler/Dependencies.mjs +2 -8
- package/output/js/ff/compiler/Deriver.mjs +2 -2
- package/output/js/ff/compiler/Inference.mjs +26 -26
- package/output/js/ff/compiler/JsEmitter.mjs +76 -36
- package/output/js/ff/compiler/Parser.mjs +60 -84
- package/output/js/ff/compiler/Patterns.mjs +4 -4
- package/output/js/ff/compiler/Tokenizer.mjs +2 -2
- package/output/js/ff/compiler/Unification.mjs +2 -2
- package/output/js/ff/compiler/Workspace.mjs +14 -14
- package/output/js/ff/core/Array.mjs +8 -8
- package/output/js/ff/core/List.mjs +40 -46
- package/output/js/ff/core/Ordering.mjs +4 -4
- package/output/js/ff/core/Random.mjs +8 -8
- package/output/js/ff/core/Serializable.mjs +8 -8
- package/output/js/ff/core/Task.mjs +2 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -139,11 +139,11 @@ return (ff_core_String.String_size(_w1) !== 0)
|
|
|
139
139
|
ff_core_Option.Option_each(defaultLocation_, ((_) => {
|
|
140
140
|
ff_core_Core.panic_(("Unexpected rule after the * rule: " + line_))
|
|
141
141
|
}));
|
|
142
|
-
if((
|
|
142
|
+
if((columns_.length !== 2)) {
|
|
143
143
|
ff_core_Core.panic_(("Could not parse workspace rule: " + line_))
|
|
144
144
|
};
|
|
145
|
-
const package_ = ff_core_List.
|
|
146
|
-
const location_ = ff_core_List.
|
|
145
|
+
const package_ = (columns_[0] ?? ff_core_List.internalGrab_(columns_, 0));
|
|
146
|
+
const location_ = (columns_[1] ?? ff_core_List.internalGrab_(columns_, 1));
|
|
147
147
|
const fixedLocation_ = (ff_core_String.String_endsWith(location_, "/")
|
|
148
148
|
? location_
|
|
149
149
|
: (location_ + "/"));
|
|
@@ -152,14 +152,14 @@ defaultLocation_ = ff_core_Option.Some(fixedLocation_);
|
|
|
152
152
|
return ff_core_Option.None()
|
|
153
153
|
} else {
|
|
154
154
|
const packageParts_ = ff_core_String.String_split(package_, 58);
|
|
155
|
-
if((
|
|
155
|
+
if((packageParts_.length !== 2)) {
|
|
156
156
|
ff_core_Core.panic_(("Could not parse workspace package: " + package_))
|
|
157
157
|
};
|
|
158
|
-
if((ff_core_List.
|
|
158
|
+
if(((packageParts_[0] ?? ff_core_List.internalGrab_(packageParts_, 0)) === "*")) {
|
|
159
159
|
ff_core_Core.panic_(("Unexpected wildcard: " + package_))
|
|
160
160
|
};
|
|
161
|
-
return ff_core_Option.Some(ff_compiler_Workspace.WorkspaceRule(ff_core_List.
|
|
162
|
-
? ff_core_Option.Some(ff_core_List.
|
|
161
|
+
return ff_core_Option.Some(ff_compiler_Workspace.WorkspaceRule((packageParts_[0] ?? ff_core_List.internalGrab_(packageParts_, 0)), (((packageParts_[1] ?? ff_core_List.internalGrab_(packageParts_, 1)) !== "*")
|
|
162
|
+
? ff_core_Option.Some((packageParts_[1] ?? ff_core_List.internalGrab_(packageParts_, 1)))
|
|
163
163
|
: ff_core_Option.None()), fixedLocation_))
|
|
164
164
|
}
|
|
165
165
|
}));
|
|
@@ -203,11 +203,11 @@ return (ff_core_String.String_size(_w1) !== 0)
|
|
|
203
203
|
ff_core_Option.Option_each(defaultLocation_, ((_) => {
|
|
204
204
|
ff_core_Core.panic_(("Unexpected rule after the * rule: " + line_))
|
|
205
205
|
}));
|
|
206
|
-
if((
|
|
206
|
+
if((columns_.length !== 2)) {
|
|
207
207
|
ff_core_Core.panic_(("Could not parse workspace rule: " + line_))
|
|
208
208
|
};
|
|
209
|
-
const package_ = ff_core_List.
|
|
210
|
-
const location_ = ff_core_List.
|
|
209
|
+
const package_ = (columns_[0] ?? ff_core_List.internalGrab_(columns_, 0));
|
|
210
|
+
const location_ = (columns_[1] ?? ff_core_List.internalGrab_(columns_, 1));
|
|
211
211
|
const fixedLocation_ = (ff_core_String.String_endsWith(location_, "/")
|
|
212
212
|
? location_
|
|
213
213
|
: (location_ + "/"));
|
|
@@ -216,14 +216,14 @@ defaultLocation_ = ff_core_Option.Some(fixedLocation_);
|
|
|
216
216
|
return ff_core_Option.None()
|
|
217
217
|
} else {
|
|
218
218
|
const packageParts_ = ff_core_String.String_split(package_, 58);
|
|
219
|
-
if((
|
|
219
|
+
if((packageParts_.length !== 2)) {
|
|
220
220
|
ff_core_Core.panic_(("Could not parse workspace package: " + package_))
|
|
221
221
|
};
|
|
222
|
-
if((ff_core_List.
|
|
222
|
+
if(((packageParts_[0] ?? ff_core_List.internalGrab_(packageParts_, 0)) === "*")) {
|
|
223
223
|
ff_core_Core.panic_(("Unexpected wildcard: " + package_))
|
|
224
224
|
};
|
|
225
|
-
return ff_core_Option.Some(ff_compiler_Workspace.WorkspaceRule(ff_core_List.
|
|
226
|
-
? ff_core_Option.Some(ff_core_List.
|
|
225
|
+
return ff_core_Option.Some(ff_compiler_Workspace.WorkspaceRule((packageParts_[0] ?? ff_core_List.internalGrab_(packageParts_, 0)), (((packageParts_[1] ?? ff_core_List.internalGrab_(packageParts_, 1)) !== "*")
|
|
226
|
+
? ff_core_Option.Some((packageParts_[1] ?? ff_core_List.internalGrab_(packageParts_, 1)))
|
|
227
227
|
: ff_core_Option.None()), fixedLocation_))
|
|
228
228
|
}
|
|
229
229
|
}));
|
|
@@ -135,7 +135,7 @@ i_ += 1
|
|
|
135
135
|
const value_ = (array_.array[j_] ?? ff_core_Array.internalGrab_(array_, j_));
|
|
136
136
|
let k_ = j_;
|
|
137
137
|
while((k_ > i_)) {
|
|
138
|
-
ff_core_Array.Array_set(array_, k_, ff_core_Array.
|
|
138
|
+
ff_core_Array.Array_set(array_, k_, (array_.array[(k_ - 1)] ?? ff_core_Array.internalGrab_(array_, (k_ - 1))));
|
|
139
139
|
k_ -= 1
|
|
140
140
|
};
|
|
141
141
|
ff_core_Array.Array_set(array_, i_, value_);
|
|
@@ -185,7 +185,7 @@ i_ += 1
|
|
|
185
185
|
const value_ = (array_.array[j_] ?? ff_core_Array.internalGrab_(array_, j_));
|
|
186
186
|
let k_ = j_;
|
|
187
187
|
while((k_ > i_)) {
|
|
188
|
-
ff_core_Array.Array_set(array_, k_, ff_core_Array.
|
|
188
|
+
ff_core_Array.Array_set(array_, k_, (array_.array[(k_ - 1)] ?? ff_core_Array.internalGrab_(array_, (k_ - 1))));
|
|
189
189
|
k_ -= 1
|
|
190
190
|
};
|
|
191
191
|
ff_core_Array.Array_set(array_, i_, value_);
|
|
@@ -224,11 +224,11 @@ export function Array_grab(self_, index_) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
export function Array_grabFirst(self_) {
|
|
227
|
-
return ff_core_Array.
|
|
227
|
+
return (self_.array[0] ?? ff_core_Array.internalGrab_(self_, 0))
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
export function Array_grabLast(self_) {
|
|
231
|
-
return
|
|
231
|
+
return (self_.array[(self_.array.length - 1)] ?? ff_core_Array.internalGrab_(self_, (self_.array.length - 1)))
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
export function Array_first(self_) {
|
|
@@ -418,11 +418,11 @@ throw new Error('Function Array_grab is missing on this target in async context.
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
export async function Array_grabFirst$(self_, $task) {
|
|
421
|
-
return ff_core_Array.
|
|
421
|
+
return (self_.array[0] ?? ff_core_Array.internalGrab_(self_, 0))
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
export async function Array_grabLast$(self_, $task) {
|
|
425
|
-
return
|
|
425
|
+
return (self_.array[(self_.array.length - 1)] ?? ff_core_Array.internalGrab_(self_, (self_.array.length - 1)))
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
export async function Array_first$(self_, $task) {
|
|
@@ -593,7 +593,7 @@ show_(value_) {
|
|
|
593
593
|
const array_ = ff_core_Array.new_();
|
|
594
594
|
array_.array.push("[");
|
|
595
595
|
ff_core_Array.Array_each(value_, ((x_) => {
|
|
596
|
-
if((
|
|
596
|
+
if((array_.array.length > 1)) {
|
|
597
597
|
array_.array.push(", ")
|
|
598
598
|
};
|
|
599
599
|
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
@@ -605,7 +605,7 @@ async show_$(value_, $task) {
|
|
|
605
605
|
const array_ = ff_core_Array.new_();
|
|
606
606
|
array_.array.push("[");
|
|
607
607
|
ff_core_Array.Array_each(value_, ((x_) => {
|
|
608
|
-
if((
|
|
608
|
+
if((array_.array.length > 1)) {
|
|
609
609
|
array_.array.push(", ")
|
|
610
610
|
};
|
|
611
611
|
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
@@ -192,15 +192,15 @@ return ff_core_List.List_get(self_, 0)
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
export function List_last(self_) {
|
|
195
|
-
return ff_core_List.List_get(self_, (
|
|
195
|
+
return ff_core_List.List_get(self_, (self_.length - 1))
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
export function List_grabFirst(self_) {
|
|
199
|
-
return ff_core_List.
|
|
199
|
+
return (self_[0] ?? ff_core_List.internalGrab_(self_, 0))
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
export function List_grabLast(self_) {
|
|
203
|
-
return ff_core_List.List_grab(self_, (
|
|
203
|
+
return ff_core_List.List_grab(self_, (self_.length - 1))
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
export function List_takeFirst(self_, count_ = 1) {
|
|
@@ -222,7 +222,7 @@ return self_.slice(0, self_.length - count_)
|
|
|
222
222
|
export function List_count(self_, body_) {
|
|
223
223
|
let result_ = 0;
|
|
224
224
|
let i_ = 0;
|
|
225
|
-
while((i_ <
|
|
225
|
+
while((i_ < self_.length)) {
|
|
226
226
|
if(body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)))) {
|
|
227
227
|
result_ += 1
|
|
228
228
|
};
|
|
@@ -233,7 +233,7 @@ return result_
|
|
|
233
233
|
|
|
234
234
|
export function List_countWhile(self_, body_) {
|
|
235
235
|
let i_ = 0;
|
|
236
|
-
while(((i_ <
|
|
236
|
+
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
|
|
237
237
|
i_ += 1
|
|
238
238
|
};
|
|
239
239
|
return i_
|
|
@@ -242,7 +242,7 @@ return i_
|
|
|
242
242
|
export function List_takeWhile(self_, body_) {
|
|
243
243
|
const result_ = ff_core_Array.new_();
|
|
244
244
|
let i_ = 0;
|
|
245
|
-
while(((i_ <
|
|
245
|
+
while(((i_ < self_.length) && 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
|
};
|
|
@@ -252,10 +252,10 @@ return ff_core_Array.Array_drain(result_)
|
|
|
252
252
|
export function List_dropWhile(self_, body_) {
|
|
253
253
|
const result_ = ff_core_Array.new_();
|
|
254
254
|
let i_ = 0;
|
|
255
|
-
while(((i_ <
|
|
255
|
+
while(((i_ < self_.length) && body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_))))) {
|
|
256
256
|
i_ += 1
|
|
257
257
|
};
|
|
258
|
-
while((i_ <
|
|
258
|
+
while((i_ < self_.length)) {
|
|
259
259
|
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
260
260
|
i_ += 1
|
|
261
261
|
};
|
|
@@ -266,11 +266,11 @@ export function List_partitionWhile(self_, body_) {
|
|
|
266
266
|
const first_ = ff_core_Array.new_();
|
|
267
267
|
const second_ = ff_core_Array.new_();
|
|
268
268
|
let i_ = 0;
|
|
269
|
-
while(((i_ <
|
|
269
|
+
while(((i_ < self_.length) && 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
|
-
while((i_ <
|
|
273
|
+
while((i_ < self_.length)) {
|
|
274
274
|
second_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
275
275
|
i_ += 1
|
|
276
276
|
};
|
|
@@ -317,7 +317,7 @@ export function List_modify(self_, index_, body_) {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
export function List_zip(self_, that_) {
|
|
320
|
-
if((
|
|
320
|
+
if((self_.length <= that_.length)) {
|
|
321
321
|
let i_ = (-1);
|
|
322
322
|
return ff_core_List.List_map(self_, ((x_) => {
|
|
323
323
|
i_ += 1;
|
|
@@ -355,7 +355,7 @@ return ff_core_Array.Array_drain(results_)
|
|
|
355
355
|
export function List_toStream(self_, cycle_ = false) {
|
|
356
356
|
let index_ = 0;
|
|
357
357
|
return ff_core_Stream.new_((() => {
|
|
358
|
-
if((index_ <
|
|
358
|
+
if((index_ < self_.length)) {
|
|
359
359
|
return ff_core_Option.Some((function() {
|
|
360
360
|
const result_ = (self_[index_] ?? ff_core_List.internalGrab_(self_, index_));
|
|
361
361
|
index_ += 1;
|
|
@@ -363,7 +363,7 @@ return result_
|
|
|
363
363
|
})())
|
|
364
364
|
} else if((cycle_ && (index_ !== 0))) {
|
|
365
365
|
return ff_core_Option.Some((function() {
|
|
366
|
-
const result_ = ff_core_List.
|
|
366
|
+
const result_ = (self_[0] ?? ff_core_List.internalGrab_(self_, 0));
|
|
367
367
|
index_ = 1;
|
|
368
368
|
return result_
|
|
369
369
|
})())
|
|
@@ -414,10 +414,7 @@ for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++)
|
|
|
414
414
|
const x_ = for_a[for_i];
|
|
415
415
|
if(!(body_(x_)
|
|
416
416
|
? (result_ = ff_core_Option.Some(i_), false)
|
|
417
|
-
: (
|
|
418
|
-
i_ += 1;
|
|
419
|
-
return true
|
|
420
|
-
})())) break
|
|
417
|
+
: (i_ += 1, true))) break
|
|
421
418
|
};
|
|
422
419
|
return result_
|
|
423
420
|
}
|
|
@@ -507,8 +504,8 @@ return ff_core_Array.Array_drain(array_)
|
|
|
507
504
|
}
|
|
508
505
|
|
|
509
506
|
export function List_reverse(self_) {
|
|
510
|
-
return ff_core_List.List_map(ff_core_Int.Int_to(1,
|
|
511
|
-
return ff_core_List.List_grab(self_, (
|
|
507
|
+
return ff_core_List.List_map(ff_core_Int.Int_to(1, self_.length), ((i_) => {
|
|
508
|
+
return ff_core_List.List_grab(self_, (self_.length - i_))
|
|
512
509
|
}))
|
|
513
510
|
}
|
|
514
511
|
|
|
@@ -553,15 +550,15 @@ return ff_core_List.List_get(self_, 0)
|
|
|
553
550
|
}
|
|
554
551
|
|
|
555
552
|
export async function List_last$(self_, $task) {
|
|
556
|
-
return ff_core_List.List_get(self_, (
|
|
553
|
+
return ff_core_List.List_get(self_, (self_.length - 1))
|
|
557
554
|
}
|
|
558
555
|
|
|
559
556
|
export async function List_grabFirst$(self_, $task) {
|
|
560
|
-
return ff_core_List.
|
|
557
|
+
return (self_[0] ?? ff_core_List.internalGrab_(self_, 0))
|
|
561
558
|
}
|
|
562
559
|
|
|
563
560
|
export async function List_grabLast$(self_, $task) {
|
|
564
|
-
return ff_core_List.List_grab(self_, (
|
|
561
|
+
return ff_core_List.List_grab(self_, (self_.length - 1))
|
|
565
562
|
}
|
|
566
563
|
|
|
567
564
|
export async function List_takeFirst$(self_, count_ = 1, $task) {
|
|
@@ -583,7 +580,7 @@ throw new Error('Function List_dropLast is missing on this target in async conte
|
|
|
583
580
|
export async function List_count$(self_, body_, $task) {
|
|
584
581
|
let result_ = 0;
|
|
585
582
|
let i_ = 0;
|
|
586
|
-
while((i_ <
|
|
583
|
+
while((i_ < self_.length)) {
|
|
587
584
|
if((await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task))) {
|
|
588
585
|
result_ += 1
|
|
589
586
|
};
|
|
@@ -594,7 +591,7 @@ return result_
|
|
|
594
591
|
|
|
595
592
|
export async function List_countWhile$(self_, body_, $task) {
|
|
596
593
|
let i_ = 0;
|
|
597
|
-
while(((i_ <
|
|
594
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
|
|
598
595
|
i_ += 1
|
|
599
596
|
};
|
|
600
597
|
return i_
|
|
@@ -603,7 +600,7 @@ return i_
|
|
|
603
600
|
export async function List_takeWhile$(self_, body_, $task) {
|
|
604
601
|
const result_ = ff_core_Array.new_();
|
|
605
602
|
let i_ = 0;
|
|
606
|
-
while(((i_ <
|
|
603
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
|
|
607
604
|
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
608
605
|
i_ += 1
|
|
609
606
|
};
|
|
@@ -613,10 +610,10 @@ return ff_core_Array.Array_drain(result_)
|
|
|
613
610
|
export async function List_dropWhile$(self_, body_, $task) {
|
|
614
611
|
const result_ = ff_core_Array.new_();
|
|
615
612
|
let i_ = 0;
|
|
616
|
-
while(((i_ <
|
|
613
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
|
|
617
614
|
i_ += 1
|
|
618
615
|
};
|
|
619
|
-
while((i_ <
|
|
616
|
+
while((i_ < self_.length)) {
|
|
620
617
|
result_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
621
618
|
i_ += 1
|
|
622
619
|
};
|
|
@@ -627,11 +624,11 @@ export async function List_partitionWhile$(self_, body_, $task) {
|
|
|
627
624
|
const first_ = ff_core_Array.new_();
|
|
628
625
|
const second_ = ff_core_Array.new_();
|
|
629
626
|
let i_ = 0;
|
|
630
|
-
while(((i_ <
|
|
627
|
+
while(((i_ < self_.length) && (await body_((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)), $task)))) {
|
|
631
628
|
first_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
632
629
|
i_ += 1
|
|
633
630
|
};
|
|
634
|
-
while((i_ <
|
|
631
|
+
while((i_ < self_.length)) {
|
|
635
632
|
second_.array.push((self_[i_] ?? ff_core_List.internalGrab_(self_, i_)));
|
|
636
633
|
i_ += 1
|
|
637
634
|
};
|
|
@@ -678,7 +675,7 @@ export async function List_modify$(self_, index_, body_, $task) {
|
|
|
678
675
|
}
|
|
679
676
|
|
|
680
677
|
export async function List_zip$(self_, that_, $task) {
|
|
681
|
-
if((
|
|
678
|
+
if((self_.length <= that_.length)) {
|
|
682
679
|
let i_ = (-1);
|
|
683
680
|
return ff_core_List.List_map(self_, ((x_) => {
|
|
684
681
|
i_ += 1;
|
|
@@ -716,7 +713,7 @@ return ff_core_Array.Array_drain(results_)
|
|
|
716
713
|
export async function List_toStream$(self_, cycle_ = false, $task) {
|
|
717
714
|
let index_ = 0;
|
|
718
715
|
return (await ff_core_Stream.new_$((async ($task) => {
|
|
719
|
-
if((index_ <
|
|
716
|
+
if((index_ < self_.length)) {
|
|
720
717
|
return ff_core_Option.Some((await (async function() {
|
|
721
718
|
const result_ = (self_[index_] ?? ff_core_List.internalGrab_(self_, index_));
|
|
722
719
|
index_ += 1;
|
|
@@ -724,7 +721,7 @@ return result_
|
|
|
724
721
|
})()))
|
|
725
722
|
} else if((cycle_ && (index_ !== 0))) {
|
|
726
723
|
return ff_core_Option.Some((await (async function() {
|
|
727
|
-
const result_ = ff_core_List.
|
|
724
|
+
const result_ = (self_[0] ?? ff_core_List.internalGrab_(self_, 0));
|
|
728
725
|
index_ = 1;
|
|
729
726
|
return result_
|
|
730
727
|
})()))
|
|
@@ -777,10 +774,7 @@ for(let for_i = 0, for_a = self_, for_l = for_a.length; for_i < for_l; for_i++)
|
|
|
777
774
|
const x_ = for_a[for_i];
|
|
778
775
|
if(!((await body_(x_, $task))
|
|
779
776
|
? (result_ = ff_core_Option.Some(i_), false)
|
|
780
|
-
: (
|
|
781
|
-
i_ += 1;
|
|
782
|
-
return true
|
|
783
|
-
})()))) break
|
|
777
|
+
: (i_ += 1, true))) break
|
|
784
778
|
};
|
|
785
779
|
return result_
|
|
786
780
|
}
|
|
@@ -874,8 +868,8 @@ return ff_core_Array.Array_drain(array_)
|
|
|
874
868
|
}
|
|
875
869
|
|
|
876
870
|
export async function List_reverse$(self_, $task) {
|
|
877
|
-
return ff_core_List.List_map(ff_core_Int.Int_to(1,
|
|
878
|
-
return ff_core_List.List_grab(self_, (
|
|
871
|
+
return ff_core_List.List_map(ff_core_Int.Int_to(1, self_.length), ((i_) => {
|
|
872
|
+
return ff_core_List.List_grab(self_, (self_.length - i_))
|
|
879
873
|
}))
|
|
880
874
|
}
|
|
881
875
|
|
|
@@ -1065,7 +1059,7 @@ const array_ = ff_core_Array.new_();
|
|
|
1065
1059
|
array_.array.push("[");
|
|
1066
1060
|
for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1067
1061
|
const x_ = for_a[for_i];
|
|
1068
|
-
if((
|
|
1062
|
+
if((array_.array.length > 1)) {
|
|
1069
1063
|
array_.array.push(", ")
|
|
1070
1064
|
};
|
|
1071
1065
|
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
@@ -1078,7 +1072,7 @@ const array_ = ff_core_Array.new_();
|
|
|
1078
1072
|
array_.array.push("[");
|
|
1079
1073
|
for(let for_i = 0, for_a = value_, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
1080
1074
|
const x_ = for_a[for_i];
|
|
1081
|
-
if((
|
|
1075
|
+
if((array_.array.length > 1)) {
|
|
1082
1076
|
array_.array.push(", ")
|
|
1083
1077
|
};
|
|
1084
1078
|
array_.array.push(ff_core_Show_Show$T.show_(x_))
|
|
@@ -1093,7 +1087,7 @@ equals_(x_, y_) {
|
|
|
1093
1087
|
if(ff_core_List.internalSame_(x_, y_)) {
|
|
1094
1088
|
return true
|
|
1095
1089
|
} else {
|
|
1096
|
-
if((
|
|
1090
|
+
if((x_.length !== y_.length)) {
|
|
1097
1091
|
return false
|
|
1098
1092
|
} else {
|
|
1099
1093
|
let i_ = (-1);
|
|
@@ -1108,7 +1102,7 @@ async equals_$(x_, y_, $task) {
|
|
|
1108
1102
|
if(ff_core_List.internalSame_(x_, y_)) {
|
|
1109
1103
|
return true
|
|
1110
1104
|
} else {
|
|
1111
|
-
if((
|
|
1105
|
+
if((x_.length !== y_.length)) {
|
|
1112
1106
|
return false
|
|
1113
1107
|
} else {
|
|
1114
1108
|
let i_ = (-1);
|
|
@@ -1126,7 +1120,7 @@ compare_(x_, y_) {
|
|
|
1126
1120
|
if(ff_core_List.internalSame_(x_, y_)) {
|
|
1127
1121
|
return ff_core_Ordering.OrderingSame()
|
|
1128
1122
|
} else {
|
|
1129
|
-
const size_ = ff_core_Int.Int_min(
|
|
1123
|
+
const size_ = ff_core_Int.Int_min(x_.length, y_.length);
|
|
1130
1124
|
let i_ = 0;
|
|
1131
1125
|
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
1132
1126
|
while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
|
|
@@ -1136,7 +1130,7 @@ i_ += 1
|
|
|
1136
1130
|
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
1137
1131
|
return ordering_
|
|
1138
1132
|
} else {
|
|
1139
|
-
return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(
|
|
1133
|
+
return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.length, y_.length)
|
|
1140
1134
|
}
|
|
1141
1135
|
}
|
|
1142
1136
|
},
|
|
@@ -1144,7 +1138,7 @@ async compare_$(x_, y_, $task) {
|
|
|
1144
1138
|
if(ff_core_List.internalSame_(x_, y_)) {
|
|
1145
1139
|
return ff_core_Ordering.OrderingSame()
|
|
1146
1140
|
} else {
|
|
1147
|
-
const size_ = ff_core_Int.Int_min(
|
|
1141
|
+
const size_ = ff_core_Int.Int_min(x_.length, y_.length);
|
|
1148
1142
|
let i_ = 0;
|
|
1149
1143
|
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
1150
1144
|
while(((ordering_ === ff_core_Ordering.OrderingSame()) && (i_ < size_))) {
|
|
@@ -1154,7 +1148,7 @@ i_ += 1
|
|
|
1154
1148
|
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
1155
1149
|
return ordering_
|
|
1156
1150
|
} else {
|
|
1157
|
-
return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(
|
|
1151
|
+
return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.length, y_.length)
|
|
1158
1152
|
}
|
|
1159
1153
|
}
|
|
1160
1154
|
}
|
|
@@ -461,12 +461,12 @@ export function ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering_Order$
|
|
|
461
461
|
compare_(x_, y_) {
|
|
462
462
|
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
463
463
|
let i_ = 0;
|
|
464
|
-
while((((i_ <
|
|
464
|
+
while((((i_ < x_.length) && (i_ < y_.length)) && (ordering_ === ff_core_Ordering.OrderingSame()))) {
|
|
465
465
|
ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.internalGrab_(x_, i_)), (y_[i_] ?? ff_core_List.internalGrab_(y_, i_)));
|
|
466
466
|
i_ += 1
|
|
467
467
|
};
|
|
468
468
|
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
469
|
-
return ff_core_Ordering.fromInt_((
|
|
469
|
+
return ff_core_Ordering.fromInt_((x_.length - y_.length))
|
|
470
470
|
} else {
|
|
471
471
|
return ordering_
|
|
472
472
|
}
|
|
@@ -474,12 +474,12 @@ return ordering_
|
|
|
474
474
|
async compare_$(x_, y_, $task) {
|
|
475
475
|
let ordering_ = ff_core_Ordering.OrderingSame();
|
|
476
476
|
let i_ = 0;
|
|
477
|
-
while((((i_ <
|
|
477
|
+
while((((i_ < x_.length) && (i_ < y_.length)) && (ordering_ === ff_core_Ordering.OrderingSame()))) {
|
|
478
478
|
ordering_ = ff_core_Ordering_Order$T.compare_((x_[i_] ?? ff_core_List.internalGrab_(x_, i_)), (y_[i_] ?? ff_core_List.internalGrab_(y_, i_)));
|
|
479
479
|
i_ += 1
|
|
480
480
|
};
|
|
481
481
|
if((ordering_ !== ff_core_Ordering.OrderingSame())) {
|
|
482
|
-
return ff_core_Ordering.fromInt_((
|
|
482
|
+
return ff_core_Ordering.fromInt_((x_.length - y_.length))
|
|
483
483
|
} else {
|
|
484
484
|
return ordering_
|
|
485
485
|
}
|
|
@@ -217,9 +217,9 @@ export function Random_nextGauss(self_, mean_, standardDeviation_) {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
export function Random_shuffleArray(self_, array_) {
|
|
220
|
-
for(let for_i = 0, for_e = (
|
|
220
|
+
for(let for_i = 0, for_e = (array_.array.length - 1); for_i < for_e; for_i++) {
|
|
221
221
|
const i_ = for_i;
|
|
222
|
-
const j_ = (ff_core_Random.Random_nextInt(self_, 0, (
|
|
222
|
+
const j_ = (ff_core_Random.Random_nextInt(self_, 0, (array_.array.length - i_)) + i_);
|
|
223
223
|
const value_ = (array_.array[i_] ?? ff_core_Array.internalGrab_(array_, i_));
|
|
224
224
|
ff_core_Array.Array_set(array_, i_, (array_.array[j_] ?? ff_core_Array.internalGrab_(array_, j_)));
|
|
225
225
|
ff_core_Array.Array_set(array_, j_, value_)
|
|
@@ -244,11 +244,11 @@ return ff_core_List.List_takeFirst(ff_core_Random.Random_shuffleList(self_, list
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
export function Random_grabArray(self_, array_) {
|
|
247
|
-
return ff_core_Array.
|
|
247
|
+
return (array_.array[ff_core_Random.Random_nextInt(self_, 0, array_.array.length)] ?? ff_core_Array.internalGrab_(array_, ff_core_Random.Random_nextInt(self_, 0, array_.array.length)))
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
export function Random_grabList(self_, list_) {
|
|
251
|
-
return ff_core_List.List_grab(list_, ff_core_Random.Random_nextInt(self_, 0,
|
|
251
|
+
return ff_core_List.List_grab(list_, ff_core_Random.Random_nextInt(self_, 0, list_.length))
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
export async function Random_copy$(self_, $task) {
|
|
@@ -279,9 +279,9 @@ throw new Error('Function Random_nextGauss is missing on this target in async co
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
export async function Random_shuffleArray$(self_, array_, $task) {
|
|
282
|
-
for(let for_i = 0, for_e = (
|
|
282
|
+
for(let for_i = 0, for_e = (array_.array.length - 1); for_i < for_e; for_i++) {
|
|
283
283
|
const i_ = for_i;
|
|
284
|
-
const j_ = (ff_core_Random.Random_nextInt(self_, 0, (
|
|
284
|
+
const j_ = (ff_core_Random.Random_nextInt(self_, 0, (array_.array.length - i_)) + i_);
|
|
285
285
|
const value_ = (array_.array[i_] ?? ff_core_Array.internalGrab_(array_, i_));
|
|
286
286
|
ff_core_Array.Array_set(array_, i_, (array_.array[j_] ?? ff_core_Array.internalGrab_(array_, j_)));
|
|
287
287
|
ff_core_Array.Array_set(array_, j_, value_)
|
|
@@ -306,11 +306,11 @@ return ff_core_List.List_takeFirst(ff_core_Random.Random_shuffleList(self_, list
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
export async function Random_grabArray$(self_, array_, $task) {
|
|
309
|
-
return ff_core_Array.
|
|
309
|
+
return (array_.array[ff_core_Random.Random_nextInt(self_, 0, array_.array.length)] ?? ff_core_Array.internalGrab_(array_, ff_core_Random.Random_nextInt(self_, 0, array_.array.length)))
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
export async function Random_grabList$(self_, list_, $task) {
|
|
313
|
-
return ff_core_List.List_grab(list_, ff_core_Random.Random_nextInt(self_, 0,
|
|
313
|
+
return ff_core_List.List_grab(list_, ff_core_Random.Random_nextInt(self_, 0, list_.length))
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
|
|
@@ -239,14 +239,14 @@ return (result_ === 1)
|
|
|
239
239
|
|
|
240
240
|
export function ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable_Serializable$T) { return {
|
|
241
241
|
serializeUsing_(serialization_, value_) {
|
|
242
|
-
if((
|
|
242
|
+
if((value_.length < 255)) {
|
|
243
243
|
ff_core_Serializable.Serialization_autoResize(serialization_, 1);
|
|
244
|
-
ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_,
|
|
244
|
+
ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, value_.length);
|
|
245
245
|
serialization_.offset_ += 1
|
|
246
|
-
} else if((
|
|
246
|
+
} else if((value_.length < 1073741824)) {
|
|
247
247
|
ff_core_Serializable.Serialization_autoResize(serialization_, (1 + 4));
|
|
248
248
|
ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 255);
|
|
249
|
-
ff_core_Buffer.Buffer_setUint32(serialization_.buffer_, (1 + serialization_.offset_),
|
|
249
|
+
ff_core_Buffer.Buffer_setUint32(serialization_.buffer_, (1 + serialization_.offset_), value_.length, true);
|
|
250
250
|
serialization_.offset_ += (1 + 4)
|
|
251
251
|
} else {
|
|
252
252
|
ff_core_Core.panic_("Can't serialize arrays where size() >= 1073741824")
|
|
@@ -282,14 +282,14 @@ return result;
|
|
|
282
282
|
}
|
|
283
283
|
},
|
|
284
284
|
async serializeUsing_$(serialization_, value_, $task) {
|
|
285
|
-
if((
|
|
285
|
+
if((value_.length < 255)) {
|
|
286
286
|
ff_core_Serializable.Serialization_autoResize(serialization_, 1);
|
|
287
|
-
ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_,
|
|
287
|
+
ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, value_.length);
|
|
288
288
|
serialization_.offset_ += 1
|
|
289
|
-
} else if((
|
|
289
|
+
} else if((value_.length < 1073741824)) {
|
|
290
290
|
ff_core_Serializable.Serialization_autoResize(serialization_, (1 + 4));
|
|
291
291
|
ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 255);
|
|
292
|
-
ff_core_Buffer.Buffer_setUint32(serialization_.buffer_, (1 + serialization_.offset_),
|
|
292
|
+
ff_core_Buffer.Buffer_setUint32(serialization_.buffer_, (1 + serialization_.offset_), value_.length, true);
|
|
293
293
|
serialization_.offset_ += (1 + 4)
|
|
294
294
|
} else {
|
|
295
295
|
ff_core_Core.panic_("Can't serialize arrays where size() >= 1073741824")
|
|
@@ -267,7 +267,7 @@ return ff_core_Error.Error_rethrow(_w1)
|
|
|
267
267
|
export function Task_race(self_, tasks_) {
|
|
268
268
|
const successChannel_ = ff_core_Task.Task_channel(self_, 0);
|
|
269
269
|
const failureChannel_ = ff_core_Task.Task_channel(self_, 0);
|
|
270
|
-
let live_ =
|
|
270
|
+
let live_ = tasks_.length;
|
|
271
271
|
const started_ = ff_core_List.List_map(tasks_, ((task_) => {
|
|
272
272
|
return ff_core_Task.Task_spawn(self_, ((_) => {
|
|
273
273
|
ff_core_Try.Try_catchAny(ff_core_Core.try_((() => {
|
|
@@ -357,7 +357,7 @@ return ff_core_Error.Error_rethrow(_w1)
|
|
|
357
357
|
export async function Task_race$(self_, tasks_, $task) {
|
|
358
358
|
const successChannel_ = (await ff_core_Task.Task_channel$(self_, 0, $task));
|
|
359
359
|
const failureChannel_ = (await ff_core_Task.Task_channel$(self_, 0, $task));
|
|
360
|
-
let live_ =
|
|
360
|
+
let live_ = tasks_.length;
|
|
361
361
|
const started_ = (await ff_core_List.List_map$(tasks_, (async (task_, $task) => {
|
|
362
362
|
return (await ff_core_Task.Task_spawn$(self_, (async (_, $task) => {
|
|
363
363
|
(await ff_core_Try.Try_catchAny$((await ff_core_Core.try_$((async ($task) => {
|
package/package.json
CHANGED