@magnusopera/fscript 0.92.4 → 0.93.0

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.
@@ -5,11 +5,11 @@ import { fold as fold_2, contains, add as add_1, singleton as singleton_1, toLis
5
5
  import { compareArrays, stringHash, clear, curry2, int32ToString, curry3, defaultOf, disposeSafe, getEnumerator, safeHash, arrayHash, equalArrays, equals, compare, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
6
6
  import { Span_$reflection } from "./Span.js";
7
7
  import { ResolvedSymbolKind, ResolvedExpression_$reflection, ResolvedBinding_$reflection } from "./TypeInfer.js";
8
- import { Type, Type_$reflection } from "./Types.js";
9
- import { filter as filter_1, toList as toList_1, map as map_2, forAll, fold as fold_1, add, toSeq, tryFind, ofList, empty as empty_2 } from "../fable_modules/fable-library-js.5.27.0/Map.js";
8
+ import { Type, Types_expand, Type_$reflection } from "./Types.js";
9
+ import { filter as filter_1, toList as toList_1, forAll, fold as fold_1, add, toSeq, map as map_1, tryFind, ofList, empty as empty_2 } from "../fable_modules/fable-library-js.5.27.0/Map.js";
10
10
  import { ofArrayWithTail, contains as contains_1, tryPick, tryItem, tryHead, ofSeq as ofSeq_1, mapIndexed, length, indexed, ofArray, append, cons, filter, choose, singleton, head, tail as tail_2, isEmpty, collect, fold, map, empty as empty_3 } from "../fable_modules/fable-library-js.5.27.0/List.js";
11
11
  import { defaultArg } from "../fable_modules/fable-library-js.5.27.0/Option.js";
12
- import { sortBy, toArray, toList as toList_2, collect as collect_1, empty as empty_4, singleton as singleton_2, append as append_1, delay, map as map_1 } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
12
+ import { sortBy, toArray, toList as toList_2, collect as collect_1, empty as empty_4, singleton as singleton_2, append as append_1, delay, map as map_2 } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
13
13
  import { Operators_InvalidArg } from "../fable_modules/fable-library-js.5.27.0/FSharp.Core.js";
14
14
  import { concat, join as join_1 } from "../fable_modules/fable-library-js.5.27.0/String.js";
15
15
  import { HashSet } from "../fable_modules/fable-library-js.5.27.0/MutableSet.js";
@@ -163,20 +163,21 @@ export function analyze(registration, options, program) {
163
163
  }, program.ResolvedStatements), {
164
164
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
165
165
  });
166
+ const typeDefinitions = map_1((_arg, declaration_1) => declaration_1.Definition, declaredTypes);
166
167
  const hostUnions = ofList(map((item_1) => [item_1.Name, item_1.Cases], registration.Unions), {
167
168
  Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
168
169
  });
169
170
  const functions = ofList(map((item_2) => [item_2.Name, item_2.Arity], registration.Functions), {
170
171
  Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
171
172
  });
172
- const knownTypes = union(ofSeq(map_1((tuple) => tuple[0], toSeq(hostTypes)), {
173
+ const knownTypes = union(ofSeq(map_2((tuple) => tuple[0], toSeq(hostTypes)), {
173
174
  Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
174
- }), ofList_1(map((_arg) => _arg.Name, registration.Unions), {
175
+ }), ofList_1(map((_arg_1) => _arg_1.Name, registration.Unions), {
175
176
  Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
176
177
  }));
177
- const knownFunctions = union(ofSeq(map_1((tuple_1) => tuple_1[0], toSeq(functions)), {
178
+ const knownFunctions = union(ofSeq(map_2((tuple_1) => tuple_1[0], toSeq(functions)), {
178
179
  Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
179
- }), ofList_1(map((_arg_1) => _arg_1.Name, filter((symbol) => {
180
+ }), ofList_1(map((_arg_2) => _arg_2.Name, filter((symbol) => {
180
181
  if (equals(symbol.Kind, ResolvedSymbolKind.ExternSymbol)) {
181
182
  return true;
182
183
  }
@@ -216,7 +217,7 @@ export function analyze(registration, options, program) {
216
217
  const before = (left_1, right_1) => forAll((key_1, value_3) => (value_3 <= defaultArg(tryFind(key_1, right_1), 0)), left_1);
217
218
  const commonClock = (clocks) => {
218
219
  if (!isEmpty(clocks)) {
219
- return fold((state_1, other) => map_2((key_2, value_5) => (min(value_5, defaultArg(tryFind(key_2, other), 0)) | 0), state_1), head(clocks), tail_2(clocks));
220
+ return fold((state_1, other) => map_1((key_2, value_5) => (min(value_5, defaultArg(tryFind(key_2, other), 0)) | 0), state_1), head(clocks), tail_2(clocks));
220
221
  }
221
222
  else {
222
223
  return clock;
@@ -263,169 +264,194 @@ export function analyze(registration, options, program) {
263
264
  disposeSafe(enumerator);
264
265
  }
265
266
  };
266
- const fromType = (source_2, visited, typ) => {
267
- let list_9, f2, mapping_9, f2_1, f2_2, mapping_12;
268
- const nested = (typ_1) => fromType(source_2, visited, typ_1);
269
- let matchResult, name_2, name_3, typ_3, typ_4, typ_5, types, fields_1, cases_2, key_3, value_8;
270
- switch (typ.tag) {
271
- case 17: {
272
- if (!contains(typ.fields[0], safeTypes)) {
273
- matchResult = 0;
274
- name_2 = typ.fields[0];
267
+ const fromType = (source_2_mut, visited_mut, typ_mut) => {
268
+ fromType:
269
+ while (true) {
270
+ const source_2 = source_2_mut, visited = visited_mut, typ = typ_mut;
271
+ let list_9, f2, mapping_10, f2_1, f2_2, mapping_13;
272
+ const nested = (typ_1) => fromType(source_2, visited, typ_1);
273
+ let matchResult, name_3, applied_1, name_4, name_5, typ_3, typ_4, typ_5, types, fields_1, cases_2, key_3, value_8;
274
+ switch (typ.tag) {
275
+ case 19: {
276
+ if (!contains(typ.fields[0], safeTypes)) {
277
+ matchResult = 0;
278
+ name_3 = typ.fields[0];
279
+ }
280
+ else {
281
+ matchResult = 10;
282
+ }
283
+ break;
275
284
  }
276
- else {
277
- matchResult = 9;
285
+ case 13: {
286
+ if (!contains(typ, visited)) {
287
+ matchResult = 1;
288
+ applied_1 = typ;
289
+ name_4 = typ.fields[0];
290
+ }
291
+ else {
292
+ matchResult = 10;
293
+ }
294
+ break;
278
295
  }
279
- break;
280
- }
281
- case 12: {
282
- if (!contains(typ.fields[0], visited)) {
283
- matchResult = 1;
284
- name_3 = typ.fields[0];
296
+ case 12: {
297
+ if (!contains(typ, visited)) {
298
+ matchResult = 2;
299
+ name_5 = typ.fields[0];
300
+ }
301
+ else {
302
+ matchResult = 10;
303
+ }
304
+ break;
285
305
  }
286
- else {
306
+ case 5: {
307
+ matchResult = 3;
308
+ typ_3 = typ.fields[0];
309
+ break;
310
+ }
311
+ case 10: {
312
+ matchResult = 4;
313
+ typ_4 = typ.fields[0];
314
+ break;
315
+ }
316
+ case 6: {
317
+ matchResult = 5;
318
+ typ_5 = typ.fields[0];
319
+ break;
320
+ }
321
+ case 7: {
322
+ matchResult = 6;
323
+ types = typ.fields[0];
324
+ break;
325
+ }
326
+ case 8: {
327
+ matchResult = 7;
328
+ fields_1 = typ.fields[0];
329
+ break;
330
+ }
331
+ case 20: {
332
+ matchResult = 7;
333
+ fields_1 = typ.fields[1];
334
+ break;
335
+ }
336
+ case 15: {
337
+ matchResult = 8;
338
+ cases_2 = typ.fields[1];
339
+ break;
340
+ }
341
+ case 9: {
287
342
  matchResult = 9;
343
+ key_3 = typ.fields[0];
344
+ value_8 = typ.fields[1];
345
+ break;
288
346
  }
289
- break;
290
- }
291
- case 5: {
292
- matchResult = 2;
293
- typ_3 = typ.fields[0];
294
- break;
295
- }
296
- case 10: {
297
- matchResult = 3;
298
- typ_4 = typ.fields[0];
299
- break;
300
- }
301
- case 6: {
302
- matchResult = 4;
303
- typ_5 = typ.fields[0];
304
- break;
305
- }
306
- case 7: {
307
- matchResult = 5;
308
- types = typ.fields[0];
309
- break;
310
- }
311
- case 8: {
312
- matchResult = 6;
313
- fields_1 = typ.fields[0];
314
- break;
315
- }
316
- case 18: {
317
- matchResult = 6;
318
- fields_1 = typ.fields[1];
319
- break;
320
- }
321
- case 13: {
322
- matchResult = 7;
323
- cases_2 = typ.fields[1];
324
- break;
325
- }
326
- case 9: {
327
- matchResult = 8;
328
- key_3 = typ.fields[0];
329
- value_8 = typ.fields[1];
330
- break;
347
+ default:
348
+ matchResult = 10;
331
349
  }
332
- default:
333
- matchResult = 9;
334
- }
335
- switch (matchResult) {
336
- case 0:
337
- return new AbstractValue(singleton_1(new Resource((source_2 + ":") + name_2, name_2, false), {
338
- Compare: (x_11, y_11) => (compare(x_11, y_11) | 0),
339
- }), empty.Fields, empty.Callables, empty.Tasks, empty.Count);
340
- case 1: {
341
- const matchValue_2 = tryFind(name_3, hostTypes);
342
- let matchResult_1, descriptor_1;
343
- if (matchValue_2 != null) {
344
- if (!contains(name_3, safeTypes)) {
345
- matchResult_1 = 0;
346
- descriptor_1 = matchValue_2;
350
+ switch (matchResult) {
351
+ case 0:
352
+ return new AbstractValue(singleton_1(new Resource((source_2 + ":") + name_3, name_3, false), {
353
+ Compare: (x_11, y_11) => (compare(x_11, y_11) | 0),
354
+ }), empty.Fields, empty.Callables, empty.Tasks, empty.Count);
355
+ case 1: {
356
+ source_2_mut = source_2;
357
+ visited_mut = add_1(typ, visited);
358
+ typ_mut = Types_expand(typeDefinitions, applied_1);
359
+ continue fromType;
360
+ }
361
+ case 2: {
362
+ const matchValue_2 = tryFind(name_5, hostTypes);
363
+ let matchResult_1, descriptor_1;
364
+ if (matchValue_2 != null) {
365
+ if (!contains(name_5, safeTypes)) {
366
+ matchResult_1 = 0;
367
+ descriptor_1 = matchValue_2;
368
+ }
369
+ else if (contains(name_5, safeTypes)) {
370
+ matchResult_1 = 1;
371
+ }
372
+ else {
373
+ matchResult_1 = 2;
374
+ }
347
375
  }
348
- else if (contains(name_3, safeTypes)) {
376
+ else if (contains(name_5, safeTypes)) {
349
377
  matchResult_1 = 1;
350
378
  }
351
379
  else {
352
380
  matchResult_1 = 2;
353
381
  }
354
- }
355
- else if (contains(name_3, safeTypes)) {
356
- matchResult_1 = 1;
357
- }
358
- else {
359
- matchResult_1 = 2;
360
- }
361
- switch (matchResult_1) {
362
- case 0: {
363
- const value_7 = new AbstractValue(singleton_1(new Resource((source_2 + ":") + name_3, name_3, false), {
364
- Compare: (x_12, y_12) => (compare(x_12, y_12) | 0),
365
- }), empty.Fields, empty.Callables, empty.Tasks, empty.Count);
366
- if (descriptor_1.HostManaged) {
367
- return value_7;
382
+ switch (matchResult_1) {
383
+ case 0: {
384
+ const value_7 = new AbstractValue(singleton_1(new Resource((source_2 + ":") + name_5, name_5, false), {
385
+ Compare: (x_12, y_12) => (compare(x_12, y_12) | 0),
386
+ }), empty.Fields, empty.Callables, empty.Tasks, empty.Count);
387
+ if (descriptor_1.HostManaged) {
388
+ return value_7;
389
+ }
390
+ else {
391
+ return combine(cons(value_7, map((tupledArg) => {
392
+ const typ_2 = tupledArg[1];
393
+ return fromType(source_2, add_1(typ_2, visited), typ_2);
394
+ }, toList_1(descriptor_1.Fields))));
395
+ }
368
396
  }
369
- else {
370
- return combine(cons(value_7, map((tupledArg) => fromType(source_2, add_1(name_3, visited), tupledArg[1]), toList_1(descriptor_1.Fields))));
397
+ case 1:
398
+ return empty;
399
+ default: {
400
+ const visited_1 = add_1(typ, visited);
401
+ const matchValue_3 = tryFind(name_5, hostUnions);
402
+ const matchValue_4 = tryFind(name_5, declaredTypes);
403
+ if (matchValue_3 != null) {
404
+ return combine((list_9 = toList_1(matchValue_3), choose((f2 = ((mapping_10 = curry3(fromType)(source_2)(visited_1), (option_4) => {
405
+ const option_5 = option_4;
406
+ return (option_5 != null) ? mapping_10(option_5) : undefined;
407
+ })), (arg) => f2(arg[1])), list_9)));
408
+ }
409
+ else if (matchValue_4 != null) {
410
+ const declaration_2 = matchValue_4;
411
+ return combine(append(map((f2_1 = curry3(fromType)(source_2)(visited_1), (arg_1) => f2_1(arg_1[1])), declaration_2.Fields), choose((f2_2 = ((mapping_13 = curry3(fromType)(source_2)(visited_1), (option_6) => {
412
+ const option_7 = option_6;
413
+ return (option_7 != null) ? mapping_13(option_7) : undefined;
414
+ })), (arg_2) => f2_2(arg_2[1])), declaration_2.Cases)));
415
+ }
416
+ else {
417
+ return empty;
418
+ }
371
419
  }
372
420
  }
373
- case 1:
374
- return empty;
375
- default: {
376
- const visited_1 = add_1(name_3, visited);
377
- const matchValue_3 = tryFind(name_3, hostUnions);
378
- const matchValue_4 = tryFind(name_3, declaredTypes);
379
- if (matchValue_3 != null) {
380
- return combine((list_9 = toList_1(matchValue_3), choose((f2 = ((mapping_9 = curry3(fromType)(source_2)(visited_1), (option_4) => {
381
- const option_5 = option_4;
382
- return (option_5 != null) ? mapping_9(option_5) : undefined;
383
- })), (arg) => f2(arg[1])), list_9)));
384
- }
385
- else if (matchValue_4 != null) {
386
- const declaration_1 = matchValue_4;
387
- return combine(append(map((f2_1 = curry3(fromType)(source_2)(visited_1), (arg_1) => f2_1(arg_1[1])), declaration_1.Fields), choose((f2_2 = ((mapping_12 = curry3(fromType)(source_2)(visited_1), (option_6) => {
388
- const option_7 = option_6;
389
- return (option_7 != null) ? mapping_12(option_7) : undefined;
390
- })), (arg_2) => f2_2(arg_2[1])), declaration_1.Cases)));
421
+ }
422
+ case 3:
423
+ return container("$items", undefined, nested(typ_3));
424
+ case 4:
425
+ return container("$value", undefined, nested(typ_4));
426
+ case 5:
427
+ return nested(typ_5);
428
+ case 6:
429
+ return combine(map(nested, types));
430
+ case 7: {
431
+ const values_4 = map_1((_arg_4, typ_6) => nested(typ_6), fields_1);
432
+ const bind$0040 = combine(map((tuple_5) => tuple_5[1], toList_1(values_4)));
433
+ return new AbstractValue(bind$0040.Resources, values_4, bind$0040.Callables, bind$0040.Tasks, bind$0040.Count);
434
+ }
435
+ case 8:
436
+ return combine(choose((arg_3) => {
437
+ const option_9 = arg_3[1];
438
+ if (option_9 != null) {
439
+ return nested(option_9);
391
440
  }
392
441
  else {
393
- return empty;
442
+ return undefined;
394
443
  }
395
- }
396
- }
397
- }
398
- case 2:
399
- return container("$items", undefined, nested(typ_3));
400
- case 3:
401
- return container("$value", undefined, nested(typ_4));
402
- case 4:
403
- return nested(typ_5);
404
- case 5:
405
- return combine(map(nested, types));
406
- case 6: {
407
- const values_4 = map_2((_arg_3, typ_6) => nested(typ_6), fields_1);
408
- const bind$0040 = combine(map((tuple_5) => tuple_5[1], toList_1(values_4)));
409
- return new AbstractValue(bind$0040.Resources, values_4, bind$0040.Callables, bind$0040.Tasks, bind$0040.Count);
444
+ }, toList_1(cases_2)));
445
+ case 9:
446
+ return combine(ofArray([nested(key_3), nested(value_8)]));
447
+ default:
448
+ return empty;
410
449
  }
411
- case 7:
412
- return combine(choose((arg_3) => {
413
- const option_9 = arg_3[1];
414
- if (option_9 != null) {
415
- return nested(option_9);
416
- }
417
- else {
418
- return undefined;
419
- }
420
- }, toList_1(cases_2)));
421
- case 8:
422
- return combine(ofArray([nested(key_3), nested(value_8)]));
423
- default:
424
- return empty;
450
+ break;
425
451
  }
426
452
  };
427
453
  const unknown = (source_3, typ_7) => fromType(source_3, empty_1({
428
- Compare: (x_13, y_13) => (comparePrimitives(x_13, y_13) | 0),
454
+ Compare: (x_13, y_13) => (compare(x_13, y_13) | 0),
429
455
  }), typ_7);
430
456
  const references = (expression) => delay(() => {
431
457
  let matchValue_6;
@@ -435,7 +461,7 @@ export function analyze(registration, options, program) {
435
461
  bindPattern:
436
462
  while (true) {
437
463
  const env_1 = env_1_mut, pattern = pattern_mut, value_10 = value_10_mut;
438
- let mapping_18, option_13;
464
+ let mapping_19, option_13;
439
465
  const bind = (env_2, pattern_1) => bindPattern(env_2, pattern_1, value_10);
440
466
  const matchValue_8 = pattern.Node;
441
467
  let matchResult_2, binding_1, patterns, fields_2, a, b, pattern_4, pattern_5, entries, tail;
@@ -508,7 +534,7 @@ export function analyze(registration, options, program) {
508
534
  return bind(env_1, pattern_5);
509
535
  case 6: {
510
536
  const env_6 = fold((env_5, tupledArg_3) => bindPattern(bindPattern(env_5, tupledArg_3[0], contents(value_10)), tupledArg_3[1], contents(value_10)), env_1, entries);
511
- return defaultArg((mapping_18 = curry2(bind)(env_6), (option_13 = tail, (option_13 != null) ? mapping_18(option_13) : undefined)), env_6);
537
+ return defaultArg((mapping_19 = curry2(bind)(env_6), (option_13 = tail, (option_13 != null) ? mapping_19(option_13) : undefined)), env_6);
512
538
  }
513
539
  default:
514
540
  return env_1;
@@ -526,9 +552,9 @@ export function analyze(registration, options, program) {
526
552
  const matchValue_10 = tryFind(reference_1.SymbolId, env_7);
527
553
  if (matchValue_10 == null) {
528
554
  if (equals(reference_1.Kind, ResolvedSymbolKind.ExternSymbol) ? true : equals(reference_1.Kind, ResolvedSymbolKind.BuiltinSymbol)) {
529
- const arity = (_arg_4) => {
530
- if (_arg_4.tag === 11) {
531
- return (1 + arity(_arg_4.fields[1])) | 0;
555
+ const arity = (_arg_5) => {
556
+ if (_arg_5.tag === 11) {
557
+ return (1 + arity(_arg_5.fields[1])) | 0;
532
558
  }
533
559
  else {
534
560
  return 0;
@@ -657,12 +683,12 @@ export function analyze(registration, options, program) {
657
683
  return contents(eval$(matchValue_9.fields[0]));
658
684
  }
659
685
  case 23:
660
- return container("$items", undefined, combine(collect((_arg_5) => {
661
- if (_arg_5.tag === 1) {
662
- return singleton(contents(eval$(_arg_5.fields[0])));
686
+ return container("$items", undefined, combine(collect((_arg_6) => {
687
+ if (_arg_6.tag === 1) {
688
+ return singleton(contents(eval$(_arg_6.fields[0])));
663
689
  }
664
690
  else {
665
- return ofArray([eval$(_arg_5.fields[0]), eval$(_arg_5.fields[1])]);
691
+ return ofArray([eval$(_arg_6.fields[0]), eval$(_arg_6.fields[1])]);
666
692
  }
667
693
  }, matchValue_9.fields[0])));
668
694
  case 7: {
@@ -684,10 +710,10 @@ export function analyze(registration, options, program) {
684
710
  }), bind$0040_2.Count);
685
711
  }
686
712
  case 10: {
687
- const name_6 = matchValue_9.fields[1];
713
+ const name_8 = matchValue_9.fields[1];
688
714
  const value_28 = eval$(matchValue_9.fields[0]);
689
715
  access(expression_1.Span, value_28.Resources);
690
- const matchValue_19 = tryFind(name_6, value_28.Fields);
716
+ const matchValue_19 = tryFind(name_8, value_28.Fields);
691
717
  if (matchValue_19 == null) {
692
718
  const matchValue_20 = expression_1.Type;
693
719
  switch (matchValue_20.tag) {
@@ -696,10 +722,10 @@ export function analyze(registration, options, program) {
696
722
  case 2:
697
723
  case 3:
698
724
  case 4:
699
- case 14:
725
+ case 16:
700
726
  return empty;
701
727
  default:
702
- return combine(ofArray([value_28, unknown("field:" + name_6, expression_1.Type)]));
728
+ return combine(ofArray([value_28, unknown("field:" + name_8, expression_1.Type)]));
703
729
  }
704
730
  }
705
731
  else {
@@ -753,7 +779,7 @@ export function analyze(registration, options, program) {
753
779
  }
754
780
  });
755
781
  const branches = (alternatives) => {
756
- const snapshot = () => toList_2(map_1((pair) => [pair[0], ofSeq_1(pair[1])], histories));
782
+ const snapshot = () => toList_2(map_2((pair) => [pair[0], ofSeq_1(pair[1])], histories));
757
783
  const clock_1 = clock;
758
784
  const matchValue_21 = snapshot();
759
785
  const results = map((branch) => {
@@ -832,7 +858,7 @@ export function analyze(registration, options, program) {
832
858
  const ids = ofSeq(references(callable.fields[2]), {
833
859
  Compare: (x_23, y_23) => (comparePrimitives(x_23, y_23) | 0),
834
860
  });
835
- callable.fields[3].contents = filter_1((id_2, _arg_12) => contains(id_2, ids), env_8);
861
+ callable.fields[3].contents = filter_1((id_2, _arg_13) => contains(id_2, ids), env_8);
836
862
  }
837
863
  }
838
864
  }
@@ -852,13 +878,13 @@ export function analyze(registration, options, program) {
852
878
  return combine(ofArray([fn_4, argument_4, unknown("unknown-call", resultType)]));
853
879
  }
854
880
  else {
855
- const invoke = (_arg_13) => {
856
- if (_arg_13.tag === 1) {
857
- const signature = _arg_13.fields[3];
858
- const name_8 = _arg_13.fields[0];
859
- const external = _arg_13.fields[2];
860
- const arity_1 = _arg_13.fields[1] | 0;
861
- const arguments$_1 = append(_arg_13.fields[4], singleton(argument_4));
881
+ const invoke = (_arg_14) => {
882
+ if (_arg_14.tag === 1) {
883
+ const signature = _arg_14.fields[3];
884
+ const name_10 = _arg_14.fields[0];
885
+ const external = _arg_14.fields[2];
886
+ const arity_1 = _arg_14.fields[1] | 0;
887
+ const arguments$_1 = append(_arg_14.fields[4], singleton(argument_4));
862
888
  if (length(arguments$_1) >= arity_1) {
863
889
  const returned = (count_2_mut, typ_8_mut) => {
864
890
  returned:
@@ -878,20 +904,20 @@ export function analyze(registration, options, program) {
878
904
  break;
879
905
  }
880
906
  };
881
- return invokeFunction(span_1)(returned(arity_1, signature))(name_8)(external)(arguments$_1);
907
+ return invokeFunction(span_1)(returned(arity_1, signature))(name_10)(external)(arguments$_1);
882
908
  }
883
909
  else {
884
910
  const bind$0040_4 = combine(arguments$_1);
885
- return new AbstractValue(bind$0040_4.Resources, bind$0040_4.Fields, singleton(new Callable(/* Function */ 1, [name_8, arity_1, external, signature, arguments$_1])), bind$0040_4.Tasks, bind$0040_4.Count);
911
+ return new AbstractValue(bind$0040_4.Resources, bind$0040_4.Fields, singleton(new Callable(/* Function */ 1, [name_10, arity_1, external, signature, arguments$_1])), bind$0040_4.Tasks, bind$0040_4.Count);
886
912
  }
887
913
  }
888
914
  else {
889
- const id_3 = _arg_13.fields[0] | 0;
915
+ const id_3 = _arg_14.fields[0] | 0;
890
916
  if (addToSet(id_3, activeCalls)) {
891
917
  const previous_2 = callSites;
892
918
  callSites = cons(span_1, previous_2);
893
919
  try {
894
- return evaluate(add(_arg_13.fields[1].SymbolId, argument_4, _arg_13.fields[3].contents))(_arg_13.fields[2]);
920
+ return evaluate(add(_arg_14.fields[1].SymbolId, argument_4, _arg_14.fields[3].contents))(_arg_14.fields[2]);
895
921
  }
896
922
  finally {
897
923
  callSites = previous_2;
@@ -927,7 +953,7 @@ export function analyze(registration, options, program) {
927
953
  }
928
954
  }
929
955
  })));
930
- const invokeFunction = (span_2) => ((resultType_1) => ((name_9) => ((external_1) => ((arguments$_2) => {
956
+ const invokeFunction = (span_2) => ((resultType_1) => ((name_11) => ((external_1) => ((arguments$_2) => {
931
957
  let option_27;
932
958
  const completed = (value_40) => choose((id_4) => {
933
959
  let matchValue_25;
@@ -978,7 +1004,7 @@ export function analyze(registration, options, program) {
978
1004
  }), empty.Count);
979
1005
  };
980
1006
  let matchResult_5, value_42, callback_1, value_43, callback_2, values_18, callback_3, values_20, values_21, thunk, value_45;
981
- switch (name_9) {
1007
+ switch (name_11) {
982
1008
  case "Task.fromResult": {
983
1009
  if (!isEmpty(arguments$_2)) {
984
1010
  if (isEmpty(tail_2(arguments$_2))) {
@@ -1190,19 +1216,19 @@ export function analyze(registration, options, program) {
1190
1216
  }
1191
1217
  default: {
1192
1218
  const inputs_1 = combine(arguments$_2);
1193
- if (external_1 && !contains(name_9, safeFunctions)) {
1194
- const arg_19 = add_1(new Resource("function:" + name_9, name_9, true), inputs_1.Resources);
1219
+ if (external_1 && !contains(name_11, safeFunctions)) {
1220
+ const arg_19 = add_1(new Resource("function:" + name_11, name_11, true), inputs_1.Resources);
1195
1221
  access(span_2, arg_19);
1196
1222
  }
1197
- const parameterTypes = (_arg_14) => {
1198
- if (_arg_14.tag === 11) {
1199
- return cons(_arg_14.fields[0], parameterTypes(_arg_14.fields[1]));
1223
+ const parameterTypes = (_arg_15) => {
1224
+ if (_arg_15.tag === 11) {
1225
+ return cons(_arg_15.fields[0], parameterTypes(_arg_15.fields[1]));
1200
1226
  }
1201
1227
  else {
1202
1228
  return empty_3();
1203
1229
  }
1204
1230
  };
1205
- const signature_1 = defaultArg((option_27 = tryFind(name_9, builtinSchemes), (option_27 != null) ? parameterTypes(option_27.fields[1]) : undefined), empty_3());
1231
+ const signature_1 = defaultArg((option_27 = tryFind(name_11, builtinSchemes), (option_27 != null) ? parameterTypes(option_27.fields[1]) : undefined), empty_3());
1206
1232
  const items_1 = combine(map(contents, filter((value_47) => isEmpty(value_47.Callables), arguments$_2)));
1207
1233
  const callbackResults = collect((tupledArg_11) => {
1208
1234
  let option_30, option_33;
@@ -1212,11 +1238,11 @@ export function analyze(registration, options, program) {
1212
1238
  return empty_3();
1213
1239
  }
1214
1240
  else {
1215
- const iterations = ((name_9.startsWith("List.") ? true : name_9.startsWith("Map.")) ? defaultArg((option_33 = tryPick((_arg_16) => _arg_16.Count, arguments$_2), (option_33 != null) ? min(2, option_33) : undefined), 2) : 1) | 0;
1241
+ const iterations = ((name_11.startsWith("List.") ? true : name_11.startsWith("Map.")) ? defaultArg((option_33 = tryPick((_arg_17) => _arg_17.Count, arguments$_2), (option_33 != null) ? min(2, option_33) : undefined), 2) : 1) | 0;
1216
1242
  return toList_2(delay(() => collect_1((matchValue_28) => singleton_2(fold((fn_5, typ_13) => apply(span_2)(typ_13)(fn_5)(items_1), callback_4, callbackParameters)), rangeDouble(1, 1, iterations))));
1217
1243
  }
1218
1244
  }, indexed(arguments$_2));
1219
- const result_6 = unknown("result:" + name_9, resultType_1);
1245
+ const result_6 = unknown("result:" + name_11, resultType_1);
1220
1246
  let matchResult_6;
1221
1247
  switch (resultType_1.tag) {
1222
1248
  case 0:
@@ -1224,7 +1250,7 @@ export function analyze(registration, options, program) {
1224
1250
  case 2:
1225
1251
  case 3:
1226
1252
  case 4:
1227
- case 14: {
1253
+ case 16: {
1228
1254
  matchResult_6 = 0;
1229
1255
  break;
1230
1256
  }
@@ -1256,25 +1282,25 @@ export function analyze(registration, options, program) {
1256
1282
  case 0:
1257
1283
  return empty;
1258
1284
  case 1:
1259
- return container("$items", tryPick((_arg_17) => _arg_17.Count, arguments$_2), contains_1(name_9, ofArray(["List.map", "List.choose", "List.collect"]), {
1285
+ return container("$items", tryPick((_arg_18) => _arg_18.Count, arguments$_2), contains_1(name_11, ofArray(["List.map", "List.choose", "List.collect"]), {
1260
1286
  Equals: (x_28, y_28) => (x_28 === y_28),
1261
1287
  GetHashCode: (x_28) => (stringHash(x_28) | 0),
1262
1288
  }) ? combine(map(contents, callbackResults)) : combine(ofArray([items_1, contents(result_6)])));
1263
1289
  case 2:
1264
- return container("$value", undefined, (name_9 === "Option.map") ? combine(callbackResults) : combine(ofArray([items_1, contents(result_6)])));
1290
+ return container("$value", undefined, (name_11 === "Option.map") ? combine(callbackResults) : combine(ofArray([items_1, contents(result_6)])));
1265
1291
  case 3:
1266
1292
  return container("$items", undefined, combine(ofArrayWithTail([contents(inputs_1), result_6], callbackResults)));
1267
1293
  case 4: {
1268
- const arity_2 = (_arg_18) => {
1269
- if (_arg_18.tag === 11) {
1270
- return (1 + arity_2(_arg_18.fields[1])) | 0;
1294
+ const arity_2 = (_arg_19) => {
1295
+ if (_arg_19.tag === 11) {
1296
+ return (1 + arity_2(_arg_19.fields[1])) | 0;
1271
1297
  }
1272
1298
  else {
1273
1299
  return 0;
1274
1300
  }
1275
1301
  };
1276
1302
  const bind$0040_5 = combine(ofArray([result_6, inputs_1]));
1277
- return new AbstractValue(bind$0040_5.Resources, bind$0040_5.Fields, singleton(new Callable(/* Function */ 1, [name_9 + " (returned function)", arity_2(resultType_1), true, resultType_1, empty_3()])), bind$0040_5.Tasks, bind$0040_5.Count);
1303
+ return new AbstractValue(bind$0040_5.Resources, bind$0040_5.Fields, singleton(new Callable(/* Function */ 1, [name_11 + " (returned function)", arity_2(resultType_1), true, resultType_1, empty_3()])), bind$0040_5.Tasks, bind$0040_5.Count);
1278
1304
  }
1279
1305
  default:
1280
1306
  return combine(ofArrayWithTail([result_6, inputs_1], callbackResults));
@@ -1298,16 +1324,16 @@ export function analyze(registration, options, program) {
1298
1324
  const matchValue_29 = enumerator_9["System.Collections.Generic.IEnumerator`1.get_Current"]().Node;
1299
1325
  switch (matchValue_29.tag) {
1300
1326
  case 1: {
1301
- const declaration_2 = matchValue_29.fields[0];
1302
- const value_53 = evaluate(environment)(declaration_2.Value);
1303
- remember(declaration_2.Binding, value_53);
1304
- if (declaration_2.IsRecursive) {
1327
+ const declaration_3 = matchValue_29.fields[0];
1328
+ const value_53 = evaluate(environment)(declaration_3.Value);
1329
+ remember(declaration_3.Binding, value_53);
1330
+ if (declaration_3.IsRecursive) {
1305
1331
  wireRecursive(environment)(singleton(value_53));
1306
1332
  }
1307
1333
  break;
1308
1334
  }
1309
1335
  case 3: {
1310
- const values_28 = map((declaration_3) => [declaration_3, evaluate(environment)(declaration_3.Value)], matchValue_29.fields[0]);
1336
+ const values_28 = map((declaration_4) => [declaration_4, evaluate(environment)(declaration_4.Value)], matchValue_29.fields[0]);
1311
1337
  const enumerator_10 = getEnumerator(values_28);
1312
1338
  try {
1313
1339
  while (enumerator_10["System.Collections.IEnumerator.MoveNext"]()) {
@@ -1322,9 +1348,9 @@ export function analyze(registration, options, program) {
1322
1348
  break;
1323
1349
  }
1324
1350
  case 2: {
1325
- const declaration_5 = matchValue_29.fields[0];
1326
- const value_55 = evaluate(environment)(declaration_5.Value);
1327
- const bound = bindPattern(environment, declaration_5.Pattern, value_55);
1351
+ const declaration_6 = matchValue_29.fields[0];
1352
+ const value_55 = evaluate(environment)(declaration_6.Value);
1353
+ const bound = bindPattern(environment, declaration_6.Pattern, value_55);
1328
1354
  const bindings_1 = (pattern_6_mut) => {
1329
1355
  bindings_1:
1330
1356
  while (true) {
@@ -1399,14 +1425,14 @@ export function analyze(registration, options, program) {
1399
1425
  break;
1400
1426
  }
1401
1427
  };
1402
- const patternIds = ofList(map((binding_9) => [binding_9.Name, binding_9.SymbolId], bindings_1(declaration_5.Pattern)), {
1428
+ const patternIds = ofList(map((binding_9) => [binding_9.Name, binding_9.SymbolId], bindings_1(declaration_6.Pattern)), {
1403
1429
  Compare: (x_30, y_30) => (comparePrimitives(x_30, y_30) | 0),
1404
1430
  });
1405
1431
  environment = fold((env_9, tupledArg_13) => {
1406
1432
  let option_39;
1407
1433
  const binding_10 = tupledArg_13[0];
1408
1434
  return add(binding_10.SymbolId, defaultArg((option_39 = tryFind(binding_10.Name, patternIds), (option_39 != null) ? tryFind(option_39, bound) : undefined), value_55), env_9);
1409
- }, bound, declaration_5.Bindings);
1435
+ }, bound, declaration_6.Bindings);
1410
1436
  break;
1411
1437
  }
1412
1438
  case 5: {