@magnusopera/fscript 0.88.0 → 0.90.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.
Files changed (101) hide show
  1. package/README.md +15 -0
  2. package/dist/FScript.Language/Ast.js +2 -2
  3. package/dist/FScript.Language/BuiltinFunctions.js +61 -68
  4. package/dist/FScript.Language/BuiltinSignatures.js +6 -6
  5. package/dist/FScript.Language/BuiltinTypes.js +1 -1
  6. package/dist/FScript.Language/Error.js +2 -2
  7. package/dist/FScript.Language/Eval.js +176 -127
  8. package/dist/FScript.Language/Execution.js +8 -7
  9. package/dist/FScript.Language/ExportSignatures.js +5 -5
  10. package/dist/FScript.Language/HostInterop.js +41 -11
  11. package/dist/FScript.Language/IncludeResolver.js +15 -19
  12. package/dist/FScript.Language/Interactive.js +9 -9
  13. package/dist/FScript.Language/Lexer.js +39 -39
  14. package/dist/FScript.Language/Parser.js +17 -17
  15. package/dist/FScript.Language/Pretty.js +5 -5
  16. package/dist/FScript.Language/Span.js +2 -2
  17. package/dist/FScript.Language/SupportCollections.js +34 -33
  18. package/dist/FScript.Language/SupportLibrary.js +21 -20
  19. package/dist/FScript.Language/TaskFunctions.js +51 -7
  20. package/dist/FScript.Language/TaskSharingAnalysis.js +310 -129
  21. package/dist/FScript.Language/Token.js +2 -2
  22. package/dist/FScript.Language/TypeInfer.js +21 -25
  23. package/dist/FScript.Language/Types.js +9 -9
  24. package/dist/FScript.Language/Value.js +11 -8
  25. package/dist/Library.js +54 -28
  26. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Array.js +325 -198
  27. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/BigInt.js +18 -6
  28. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/CHANGELOG.md +64 -1
  29. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Date.js +1 -1
  30. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Decimal.js +33 -47
  31. package/dist/fable_modules/fable-library-js.5.27.0/Double.js +78 -0
  32. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/FSharp.Core.js +7 -1
  33. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Global.js +1 -1
  34. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Int32.js +10 -1
  35. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/List.js +230 -157
  36. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Long.js +7 -2
  37. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Map.js +46 -39
  38. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/MutableMap.js +76 -96
  39. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/MutableSet.js +58 -80
  40. package/dist/fable_modules/fable-library-js.5.27.0/NumberStyles.js +56 -0
  41. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Numeric.js +72 -4
  42. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Random.js +26 -17
  43. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Range.js +4 -3
  44. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Reflection.js +7 -1
  45. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/RegExp.js +3 -2
  46. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Seq.js +149 -70
  47. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Seq2.js +4 -8
  48. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Set.js +66 -59
  49. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/String.js +160 -39
  50. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/System.Collections.Generic.js +3 -2
  51. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/System.Text.js +10 -10
  52. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/System.js +5 -5
  53. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/TimeOnly.js +1 -1
  54. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Types.js +28 -10
  55. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Util.js +151 -54
  56. package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/package.json +1 -1
  57. package/dist/fable_modules/project_cracked.json +1 -1
  58. package/package.json +1 -1
  59. package/dist/fable_modules/fable-library-js.5.24.0/Double.js +0 -53
  60. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Async.js +0 -0
  61. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/AsyncBuilder.js +0 -0
  62. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/BitConverter.js +0 -0
  63. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Boolean.js +0 -0
  64. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Char.js +0 -0
  65. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Choice.js +0 -0
  66. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/CollectionUtil.js +0 -0
  67. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/ConditionalWeakTable.js +0 -0
  68. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/DateOffset.js +0 -0
  69. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/DateOnly.js +0 -0
  70. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/DateOnlyTemporal.js +0 -0
  71. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/DateTimeFormat.js +0 -0
  72. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/DateTimeOffsetTemporal.js +0 -0
  73. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/DateTimeTemporal.js +0 -0
  74. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Directory.js +0 -0
  75. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Encoding.js +0 -0
  76. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Environment.js +0 -0
  77. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Event.js +0 -0
  78. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/FSharp.Collections.js +0 -0
  79. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/FSharp.Core.CompilerServices.js +0 -0
  80. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/File.js +0 -0
  81. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Guid.js +0 -0
  82. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/MailboxProcessor.js +0 -0
  83. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/MapUtil.js +0 -0
  84. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Native.js +0 -0
  85. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Observable.js +0 -0
  86. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Option.js +0 -0
  87. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Path.js +0 -0
  88. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/README.md +0 -0
  89. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Result.js +0 -0
  90. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Stopwatch.js +0 -0
  91. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Task.js +0 -0
  92. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/TaskBuilder.js +0 -0
  93. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/TimeOnlyTemporal.js +0 -0
  94. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/TimeSpan.js +0 -0
  95. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/TimeSpanTemporal.js +0 -0
  96. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Timer.js +0 -0
  97. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Unicode.13.0.0.js +0 -0
  98. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/Uri.js +0 -0
  99. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/big.d.ts +0 -0
  100. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/lib/big.js +0 -0
  101. /package/dist/fable_modules/{fable-library-js.5.24.0 → fable-library-js.5.27.0}/quotation.js +0 -0
@@ -1,14 +1,15 @@
1
1
 
2
2
  import { MapKey, Value } from "./Value.js";
3
- import { defaultOf, sign, comparePrimitives, Exception } from "../fable_modules/fable-library-js.5.24.0/Util.js";
4
- import { toInt32_unchecked, fromInt32, toInt64_unchecked, compare } from "../fable_modules/fable-library-js.5.24.0/BigInt.js";
5
- import { compareOrdinal } from "../fable_modules/fable-library-js.5.24.0/String.js";
3
+ import { Operators_InvalidOp, Operators_InvalidArg } from "../fable_modules/fable-library-js.5.27.0/FSharp.Core.js";
4
+ import { toInt32_unchecked, fromInt32, toInt64_unchecked, compare } from "../fable_modules/fable-library-js.5.27.0/BigInt.js";
5
+ import { defaultOf, sign, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
6
+ import { compareOrdinal } from "../fable_modules/fable-library-js.5.27.0/String.js";
6
7
  import { Execution_fold, Execution_map, Execution$1, Execution$1__get_IsImmediate } from "./Execution.js";
7
- import { last, chunkBySize, unzip, zip, skip, length, take, ofArray, mapIndexed, singleton, map, append, empty, reverse, cons, head as head_3, tail as tail_7, isEmpty } from "../fable_modules/fable-library-js.5.24.0/List.js";
8
- import { toList } from "../fable_modules/fable-library-js.5.24.0/Seq.js";
9
- import { rangeDouble } from "../fable_modules/fable-library-js.5.24.0/Range.js";
10
- import { remove, add, tryFind, toList as toList_1 } from "../fable_modules/fable-library-js.5.24.0/Map.js";
11
- import { toArray } from "../fable_modules/fable-library-js.5.24.0/Option.js";
8
+ import { last, chunkBySize, unzip, zip, skip, length, take, ofArray, mapIndexed, singleton, map, append, empty, reverse, cons, head as head_3, tail as tail_7, isEmpty } from "../fable_modules/fable-library-js.5.27.0/List.js";
9
+ import { toList } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
10
+ import { rangeDouble } from "../fable_modules/fable-library-js.5.27.0/Range.js";
11
+ import { remove, add, tryFind, toList as toList_1 } from "../fable_modules/fable-library-js.5.27.0/Map.js";
12
+ import { toArray } from "../fable_modules/fable-library-js.5.27.0/Option.js";
12
13
  import { invokeScalar } from "./SupportLibrary.js";
13
14
 
14
15
  function keyValue(_arg) {
@@ -66,7 +67,7 @@ function mapKey(_arg) {
66
67
  case 3:
67
68
  return new MapKey(/* MKUnionCase */ 3, [t, c]);
68
69
  default:
69
- throw new Exception("Unsupported map key. (Parameter \'key\')");
70
+ throw Operators_InvalidArg("key", "Unsupported map key.");
70
71
  }
71
72
  }
72
73
 
@@ -75,13 +76,13 @@ function boolValue(_arg) {
75
76
  return _arg.fields[0];
76
77
  }
77
78
  else {
78
- throw new Exception("Expected bool. (Parameter \'predicate\')");
79
+ throw Operators_InvalidArg("predicate", "Expected bool.");
79
80
  }
80
81
  }
81
82
 
82
83
  function count(value) {
83
84
  if ((compare(value, 0n) < 0) ? true : (compare(value, toInt64_unchecked(fromInt32(2147483647))) > 0)) {
84
- throw new Exception("Count must be between 0 and 2147483647. (Parameter \'count\')");
85
+ throw Operators_InvalidArg("count", "Count must be between 0 and 2147483647.");
85
86
  }
86
87
  return ~~toInt32_unchecked(value) | 0;
87
88
  }
@@ -157,7 +158,7 @@ function compareKey(left, right) {
157
158
  case 4:
158
159
  return 0;
159
160
  default:
160
- throw new Exception("List.sortBy requires scalar keys; use List.sortWith for composite keys. (Parameter \'projection\')");
161
+ throw Operators_InvalidArg("projection", "List.sortBy requires scalar keys; use List.sortWith for composite keys.");
161
162
  }
162
163
  }
163
164
 
@@ -1536,7 +1537,7 @@ export function invoke(equal, apply, name, arguments$) {
1536
1537
  const second = () => (new Execution$1(new Value(/* VList */ 5, [take(n_2, values_5)]), defaultOf()));
1537
1538
  let body_30;
1538
1539
  if (n_2 > length(values_5)) {
1539
- throw new Exception("Count exceeds list length. (Parameter \'count\')");
1540
+ throw Operators_InvalidArg("count", "Count exceeds list length.");
1540
1541
  body_30 = (new Execution$1(undefined, defaultOf()));
1541
1542
  }
1542
1543
  else {
@@ -1573,7 +1574,7 @@ export function invoke(equal, apply, name, arguments$) {
1573
1574
  const second_1 = () => (new Execution$1(new Value(/* VList */ 5, [skip(n_4, values_6)]), defaultOf()));
1574
1575
  let body_31;
1575
1576
  if (n_4 > length(values_6)) {
1576
- throw new Exception("Count exceeds list length. (Parameter \'count\')");
1577
+ throw Operators_InvalidArg("count", "Count exceeds list length.");
1577
1578
  body_31 = (new Execution$1(undefined, defaultOf()));
1578
1579
  }
1579
1580
  else {
@@ -1755,7 +1756,7 @@ export function invoke(equal, apply, name, arguments$) {
1755
1756
  case 0:
1756
1757
  return [a_5, b_5];
1757
1758
  default:
1758
- throw new Exception("Expected pairs. (Parameter \'pairs\')");
1759
+ throw Operators_InvalidArg("pairs", "Expected pairs.");
1759
1760
  }
1760
1761
  }, values_10));
1761
1762
  return new Execution$1(new Value(/* VTuple */ 6, [ofArray([new Value(/* VList */ 5, [patternInput[0]]), new Value(/* VList */ 5, [patternInput[1]])])]), defaultOf());
@@ -1829,7 +1830,7 @@ export function invoke(equal, apply, name, arguments$) {
1829
1830
  if (Execution$1__get_IsImmediate(body_45)) {
1830
1831
  const result_5 = body_45.Value;
1831
1832
  return new Execution$1((result_5.tag === 1) ? compare(result_5.fields[0], 0n) : (() => {
1832
- throw new Exception("Expected int. (Parameter \'comparer\')");
1833
+ throw Operators_InvalidArg("comparer", "Expected int.");
1833
1834
  })(), defaultOf());
1834
1835
  }
1835
1836
  else {
@@ -1839,7 +1840,7 @@ export function invoke(equal, apply, name, arguments$) {
1839
1840
  let execution_38;
1840
1841
  const result_5 = execution_39.Value;
1841
1842
  execution_38 = (new Execution$1((result_5.tag === 1) ? compare(result_5.fields[0], 0n) : (() => {
1842
- throw new Exception("Expected int. (Parameter \'comparer\')");
1843
+ throw Operators_InvalidArg("comparer", "Expected int.");
1843
1844
  })(), defaultOf()));
1844
1845
  const continuation_58 = continuation_57;
1845
1846
  if (Execution$1__get_IsImmediate(execution_38)) {
@@ -1854,7 +1855,7 @@ export function invoke(equal, apply, name, arguments$) {
1854
1855
  let execution_38;
1855
1856
  const result_5 = value_79;
1856
1857
  execution_38 = (new Execution$1((result_5.tag === 1) ? compare(result_5.fields[0], 0n) : (() => {
1857
- throw new Exception("Expected int. (Parameter \'comparer\')");
1858
+ throw Operators_InvalidArg("comparer", "Expected int.");
1858
1859
  })(), defaultOf()));
1859
1860
  const continuation_58 = continuation_57;
1860
1861
  return Execution$1__get_IsImmediate(execution_38) ? continuation_58(execution_38.Value) : execution_38.Resume(continuation_58);
@@ -1976,7 +1977,7 @@ export function invoke(equal, apply, name, arguments$) {
1976
1977
  case 0:
1977
1978
  return new Execution$1(compareKey(a_7, b_7), defaultOf());
1978
1979
  default:
1979
- throw new Exception("Expected decorated value.");
1980
+ throw Operators_InvalidOp("Expected decorated value.");
1980
1981
  }
1981
1982
  }), body_53.Value);
1982
1983
  if (Execution$1__get_IsImmediate(body_51)) {
@@ -2008,7 +2009,7 @@ export function invoke(equal, apply, name, arguments$) {
2008
2009
  case 0:
2009
2010
  return value_89;
2010
2011
  default:
2011
- throw new Exception("Expected decorated value.");
2012
+ throw Operators_InvalidOp("Expected decorated value.");
2012
2013
  }
2013
2014
  }, body_51.Value)]), defaultOf());
2014
2015
  }
@@ -2044,7 +2045,7 @@ export function invoke(equal, apply, name, arguments$) {
2044
2045
  case 0:
2045
2046
  return value_89;
2046
2047
  default:
2047
- throw new Exception("Expected decorated value.");
2048
+ throw Operators_InvalidOp("Expected decorated value.");
2048
2049
  }
2049
2050
  }, execution_45.Value)]), defaultOf());
2050
2051
  const continuation_67 = continuation_66;
@@ -2085,7 +2086,7 @@ export function invoke(equal, apply, name, arguments$) {
2085
2086
  case 0:
2086
2087
  return value_89;
2087
2088
  default:
2088
- throw new Exception("Expected decorated value.");
2089
+ throw Operators_InvalidOp("Expected decorated value.");
2089
2090
  }
2090
2091
  }, value_92)]), defaultOf());
2091
2092
  const continuation_67 = continuation_66;
@@ -2149,7 +2150,7 @@ export function invoke(equal, apply, name, arguments$) {
2149
2150
  case 0:
2150
2151
  return new Execution$1(compareKey(a_7, b_7), defaultOf());
2151
2152
  default:
2152
- throw new Exception("Expected decorated value.");
2153
+ throw Operators_InvalidOp("Expected decorated value.");
2153
2154
  }
2154
2155
  }), execution_47.Value);
2155
2156
  execution_46 = (Execution$1__get_IsImmediate(body_51) ? (new Execution$1(new Value(/* VList */ 5, [map((_arg_26) => {
@@ -2180,7 +2181,7 @@ export function invoke(equal, apply, name, arguments$) {
2180
2181
  case 0:
2181
2182
  return value_89;
2182
2183
  default:
2183
- throw new Exception("Expected decorated value.");
2184
+ throw Operators_InvalidOp("Expected decorated value.");
2184
2185
  }
2185
2186
  }, body_51.Value)]), defaultOf())) : (new Execution$1(defaultOf(), (continuation_66) => {
2186
2187
  const execution_45 = body_51;
@@ -2213,7 +2214,7 @@ export function invoke(equal, apply, name, arguments$) {
2213
2214
  case 0:
2214
2215
  return value_89;
2215
2216
  default:
2216
- throw new Exception("Expected decorated value.");
2217
+ throw Operators_InvalidOp("Expected decorated value.");
2217
2218
  }
2218
2219
  }, execution_45.Value)]), defaultOf());
2219
2220
  const continuation_67 = continuation_66;
@@ -2254,7 +2255,7 @@ export function invoke(equal, apply, name, arguments$) {
2254
2255
  case 0:
2255
2256
  return value_89;
2256
2257
  default:
2257
- throw new Exception("Expected decorated value.");
2258
+ throw Operators_InvalidOp("Expected decorated value.");
2258
2259
  }
2259
2260
  }, value_92)]), defaultOf());
2260
2261
  const continuation_67 = continuation_66;
@@ -2322,7 +2323,7 @@ export function invoke(equal, apply, name, arguments$) {
2322
2323
  case 0:
2323
2324
  return new Execution$1(compareKey(a_7, b_7), defaultOf());
2324
2325
  default:
2325
- throw new Exception("Expected decorated value.");
2326
+ throw Operators_InvalidOp("Expected decorated value.");
2326
2327
  }
2327
2328
  }), value_93);
2328
2329
  execution_46 = (Execution$1__get_IsImmediate(body_51) ? (new Execution$1(new Value(/* VList */ 5, [map((_arg_26) => {
@@ -2353,7 +2354,7 @@ export function invoke(equal, apply, name, arguments$) {
2353
2354
  case 0:
2354
2355
  return value_89;
2355
2356
  default:
2356
- throw new Exception("Expected decorated value.");
2357
+ throw Operators_InvalidOp("Expected decorated value.");
2357
2358
  }
2358
2359
  }, body_51.Value)]), defaultOf())) : (new Execution$1(defaultOf(), (continuation_66) => {
2359
2360
  const execution_45 = body_51;
@@ -2386,7 +2387,7 @@ export function invoke(equal, apply, name, arguments$) {
2386
2387
  case 0:
2387
2388
  return value_89;
2388
2389
  default:
2389
- throw new Exception("Expected decorated value.");
2390
+ throw Operators_InvalidOp("Expected decorated value.");
2390
2391
  }
2391
2392
  }, execution_45.Value)]), defaultOf());
2392
2393
  const continuation_67 = continuation_66;
@@ -2427,7 +2428,7 @@ export function invoke(equal, apply, name, arguments$) {
2427
2428
  case 0:
2428
2429
  return value_89;
2429
2430
  default:
2430
- throw new Exception("Expected decorated value.");
2431
+ throw Operators_InvalidOp("Expected decorated value.");
2431
2432
  }
2432
2433
  }, value_92)]), defaultOf());
2433
2434
  const continuation_67 = continuation_66;
@@ -2665,7 +2666,7 @@ export function invoke(equal, apply, name, arguments$) {
2665
2666
  if (Execution$1__get_IsImmediate(body_64)) {
2666
2667
  const next_3 = body_64.Value;
2667
2668
  return new Execution$1((next_3.tag === 9) ? ((next_3.fields[0] != null) ? ((value_116 = next_3.fields[0], new Value(/* VMap */ 8, [add(key_6, value_116, values_20)]))) : (new Value(/* VMap */ 8, [remove(key_6, values_20)]))) : (() => {
2668
- throw new Exception("Expected option. (Parameter \'updater\')");
2669
+ throw Operators_InvalidArg("updater", "Expected option.");
2669
2670
  })(), defaultOf());
2670
2671
  }
2671
2672
  else {
@@ -2676,7 +2677,7 @@ export function invoke(equal, apply, name, arguments$) {
2676
2677
  let execution_56;
2677
2678
  const next_3 = execution_57.Value;
2678
2679
  execution_56 = (new Execution$1((next_3.tag === 9) ? ((next_3.fields[0] != null) ? ((value_116 = next_3.fields[0], new Value(/* VMap */ 8, [add(key_6, value_116, values_20)]))) : (new Value(/* VMap */ 8, [remove(key_6, values_20)]))) : (() => {
2679
- throw new Exception("Expected option. (Parameter \'updater\')");
2680
+ throw Operators_InvalidArg("updater", "Expected option.");
2680
2681
  })(), defaultOf()));
2681
2682
  const continuation_85 = continuation_84;
2682
2683
  if (Execution$1__get_IsImmediate(execution_56)) {
@@ -2692,7 +2693,7 @@ export function invoke(equal, apply, name, arguments$) {
2692
2693
  let execution_56;
2693
2694
  const next_3 = value_119;
2694
2695
  execution_56 = (new Execution$1((next_3.tag === 9) ? ((next_3.fields[0] != null) ? ((value_116 = next_3.fields[0], new Value(/* VMap */ 8, [add(key_6, value_116, values_20)]))) : (new Value(/* VMap */ 8, [remove(key_6, values_20)]))) : (() => {
2695
- throw new Exception("Expected option. (Parameter \'updater\')");
2696
+ throw Operators_InvalidArg("updater", "Expected option.");
2696
2697
  })(), defaultOf()));
2697
2698
  const continuation_85 = continuation_84;
2698
2699
  return Execution$1__get_IsImmediate(execution_56) ? continuation_85(execution_56.Value) : execution_56.Resume(continuation_85);
@@ -1,15 +1,16 @@
1
1
 
2
- import { filter, zip, append, contains, tail as tail_2, head as head_2, isEmpty, cons, reverse, singleton, empty, map, ofArray, foldBack } from "../fable_modules/fable-library-js.5.24.0/List.js";
2
+ import { filter, zip, append, contains, tail as tail_2, head as head_2, isEmpty, cons, reverse, singleton, empty, map, ofArray, foldBack } from "../fable_modules/fable-library-js.5.27.0/List.js";
3
3
  import { Scheme, Type } from "./Types.js";
4
- import { FSharpMap__get_Item, ofList } from "../fable_modules/fable-library-js.5.24.0/Map.js";
5
- import { round, curry2, sign, Exception, stringHash, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.24.0/Util.js";
6
- import { ofSeq, ofList as ofList_1 } from "../fable_modules/fable-library-js.5.24.0/Set.js";
7
- import { concat, replicate, padRight, padLeft, indexOf, replace, compareOrdinal, substring, trimEnd, split, join, startsWith } from "../fable_modules/fable-library-js.5.24.0/String.js";
8
- import { item, setItem, fill, fold } from "../fable_modules/fable-library-js.5.24.0/Array.js";
9
- import { map as map_1, delay, toArray, forAll } from "../fable_modules/fable-library-js.5.24.0/Seq.js";
4
+ import { FSharpMap__get_Item, ofList } from "../fable_modules/fable-library-js.5.27.0/Map.js";
5
+ import { round, curry2, sign, stringHash, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
6
+ import { ofSeq, ofList as ofList_1 } from "../fable_modules/fable-library-js.5.27.0/Set.js";
7
+ import { concat, replicate, padRight, padLeft, indexOf, replace, compareOrdinal, getCharAtIndex, substring, trimEnd, split, join, startsWith } from "../fable_modules/fable-library-js.5.27.0/String.js";
8
+ import { item, setItem, fill, fold } from "../fable_modules/fable-library-js.5.27.0/Array.js";
9
+ import { Operators_InvalidArg } from "../fable_modules/fable-library-js.5.27.0/FSharp.Core.js";
10
+ import { map as map_1, delay, toArray, forAll } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
10
11
  import { Value } from "./Value.js";
11
- import { compare, toInt32_unchecked, fromFloat64, max, min, toFloat64, abs, equals as equals_1, fromInt32, toInt64_unchecked } from "../fable_modules/fable-library-js.5.24.0/BigInt.js";
12
- import { isInfinity, max as max_1, min as min_1 } from "../fable_modules/fable-library-js.5.24.0/Double.js";
12
+ import { compare, toInt32_unchecked, fromFloat64, max, min, toFloat64, abs, equals as equals_1, fromInt32, toInt64_unchecked } from "../fable_modules/fable-library-js.5.27.0/BigInt.js";
13
+ import { isInfinity, max as max_1, min as min_1 } from "../fable_modules/fable-library-js.5.27.0/Double.js";
13
14
 
14
15
  function fn(arguments$, result) {
15
16
  return foldBack((argument, result_1) => (new Type(/* TFun */ 11, [argument, result_1])), arguments$, result);
@@ -177,13 +178,13 @@ function segmentMatch(pattern, text) {
177
178
  let previous = fill(new Array(text.length + 1), 0, text.length + 1, false);
178
179
  setItem(previous, 0, true);
179
180
  for (let tokenIndex = 0; tokenIndex <= (pattern.length - 1); tokenIndex++) {
180
- const token = pattern[tokenIndex];
181
+ const token = getCharAtIndex(pattern, tokenIndex);
181
182
  const current = fill(new Array(text.length + 1), 0, text.length + 1, false);
182
183
  if (token === "*") {
183
184
  setItem(current, 0, item(0, previous));
184
185
  }
185
186
  for (let index = 1; index <= text.length; index++) {
186
- setItem(current, index, (token === "*") ? (item(index, previous) ? true : item(index - 1, current)) : (item(index - 1, previous) && ((token === "?") ? true : (token === text[index - 1]))));
187
+ setItem(current, index, (token === "*") ? (item(index, previous) ? true : item(index - 1, current)) : (item(index - 1, previous) && ((token === "?") ? true : (token === getCharAtIndex(text, index - 1)))));
187
188
  }
188
189
  previous = current;
189
190
  }
@@ -201,7 +202,7 @@ export function globMatch(pattern, path) {
201
202
  return false;
202
203
  }
203
204
  })) {
204
- throw new Exception("Glob ** must occupy an entire path segment. (Parameter \'pattern\')");
205
+ throw Operators_InvalidArg("pattern", "Glob ** must occupy an entire path segment.");
205
206
  }
206
207
  let previous = fill(new Array(parts.length + 1), 0, parts.length + 1, false);
207
208
  setItem(previous, 0, true);
@@ -302,9 +303,9 @@ export function parseVersion(text) {
302
303
  }
303
304
 
304
305
  export function formatVersion(parts) {
305
- const text = (join(".", parts.slice(0, 2 + 1)) + ((item(3, parts) === "") ? "" : ("-" + item(3, parts)))) + ((item(4, parts) === "") ? "" : ("+" + item(4, parts)));
306
+ const text = (join(".", parts.slice(0, 3)) + ((item(3, parts) === "") ? "" : ("-" + item(3, parts)))) + ((item(4, parts) === "") ? "" : ("+" + item(4, parts)));
306
307
  if (parseVersion(text) == null) {
307
- throw new Exception("Invalid semantic version components. (Parameter \'version\')");
308
+ throw Operators_InvalidArg("version", "Invalid semantic version components.");
308
309
  }
309
310
  return text;
310
311
  }
@@ -349,7 +350,7 @@ export function compareVersions(left, right) {
349
350
  break;
350
351
  }
351
352
  };
352
- const core = compareParts(curry2(number), ofArray(left.slice(0, 2 + 1)), ofArray(right.slice(0, 2 + 1))) | 0;
353
+ const core = compareParts(curry2(number), ofArray(left.slice(0, 3)), ofArray(right.slice(0, 3))) | 0;
353
354
  if (core !== 0) {
354
355
  return core | 0;
355
356
  }
@@ -390,12 +391,12 @@ function trimText(left, right, text) {
390
391
  let start = 0;
391
392
  let finish = text.length;
392
393
  if (left) {
393
- while ((start < finish) && whitespace(text[start])) {
394
+ while ((start < finish) && whitespace(getCharAtIndex(text, start))) {
394
395
  start = ((start + 1) | 0);
395
396
  }
396
397
  }
397
398
  if (right) {
398
- while ((finish > start) && whitespace(text[finish - 1])) {
399
+ while ((finish > start) && whitespace(getCharAtIndex(text, finish - 1))) {
399
400
  finish = ((finish - 1) | 0);
400
401
  }
401
402
  }
@@ -1824,7 +1825,7 @@ export function invokeScalar(name, arguments$) {
1824
1825
  return new Value(/* VInt */ 1, [toInt64_unchecked(fromInt32(sign(compareOrdinal(left, right))))]);
1825
1826
  case 1: {
1826
1827
  if (equals_1(x_6, -9223372036854775808n)) {
1827
- throw new Exception("Integer overflow. (Parameter \'value\')");
1828
+ throw Operators_InvalidArg("value", "Integer overflow.");
1828
1829
  }
1829
1830
  return new Value(/* VInt */ 1, [abs(x_6)]);
1830
1831
  }
@@ -1961,7 +1962,7 @@ export function invokeScalar(name, arguments$) {
1961
1962
  return matchValue_1.fields[0];
1962
1963
  }
1963
1964
  else {
1964
- throw new Exception("Invalid semantic version (Parameter \'version\')");
1965
+ throw Operators_InvalidArg("version", "Invalid semantic version");
1965
1966
  }
1966
1967
  }, versionFields))))]);
1967
1968
  case 57: {
@@ -1989,7 +1990,7 @@ export function invokeScalar(name, arguments$) {
1989
1990
  }
1990
1991
  }
1991
1992
  default:
1992
- throw new Exception(concat("Invalid arguments to ", name, ".") + " (Parameter \'arguments\')");
1993
+ throw Operators_InvalidArg("arguments", concat("Invalid arguments to ", name, "."));
1993
1994
  }
1994
1995
  }
1995
1996
 
@@ -1,10 +1,28 @@
1
1
 
2
- import { head, tail, isEmpty, singleton } from "../fable_modules/fable-library-js.5.24.0/List.js";
2
+ import { exists, length, fold, head, tail, isEmpty, find, ofArray, empty, singleton, foldBack } from "../fable_modules/fable-library-js.5.27.0/List.js";
3
3
  import { Scheme as Scheme_1, Type } from "./Types.js";
4
- import { Exception } from "../fable_modules/fable-library-js.5.24.0/Util.js";
5
- import { ExternalFunction } from "./Value.js";
4
+ import { Operators_InvalidArg } from "../fable_modules/fable-library-js.5.27.0/FSharp.Core.js";
5
+ import { Value, ExternalFunction } from "./Value.js";
6
+ import { FSharpRef } from "../fable_modules/fable-library-js.5.27.0/Types.js";
7
+ import { defaultOf } from "../fable_modules/fable-library-js.5.27.0/Util.js";
6
8
 
7
- export const spawn = new ExternalFunction("Task.spawn", new Scheme_1(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TUnit, new Type(/* TVar */ 15, [0])]), new Type(/* TTask */ 6, [new Type(/* TVar */ 15, [0])])])), (context, args) => {
9
+ function fn(arguments$, result) {
10
+ return foldBack((argument, result_1) => (new Type(/* TFun */ 11, [argument, result_1])), arguments$, result);
11
+ }
12
+
13
+ export const patternInput$00406 = [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])];
14
+
15
+ export const b = patternInput$00406[1];
16
+
17
+ const a = patternInput$00406[0];
18
+
19
+ export const signatures = ofArray([["Task.spawn", new Scheme_1(singleton(0), fn(singleton(fn(singleton(Type.TUnit), a)), new Type(/* TTask */ 6, [a]))), singleton("thunk")], ["Task.await", new Scheme_1(singleton(0), fn(singleton(new Type(/* TTask */ 6, [a])), a)), singleton("task")], ["Task.delay", new Scheme_1(empty(), fn(singleton(Type.TInt), new Type(/* TTask */ 6, [Type.TUnit]))), singleton("milliseconds")], ["Task.fromResult", new Scheme_1(singleton(0), fn(singleton(a), new Type(/* TTask */ 6, [a]))), singleton("value")], ["Task.continueWith", new Scheme_1(ofArray([0, 1]), fn(ofArray([fn(singleton(a), b), new Type(/* TTask */ 6, [a])]), new Type(/* TTask */ 6, [b]))), ofArray(["continuation", "task"])], ["Task.whenAll", new Scheme_1(ofArray([0, 1]), fn(ofArray([fn(singleton(new Type(/* TList */ 5, [a])), b), new Type(/* TList */ 5, [new Type(/* TTask */ 6, [a])])]), new Type(/* TTask */ 6, [b]))), ofArray(["continuation", "tasks"])], ["Task.whenAny", new Scheme_1(ofArray([0, 1]), fn(ofArray([fn(singleton(a), b), new Type(/* TList */ 5, [new Type(/* TTask */ 6, [a])])]), new Type(/* TTask */ 6, [b]))), ofArray(["continuation", "tasks"])], ["Task.awaitAll", new Scheme_1(singleton(0), fn(singleton(new Type(/* TList */ 5, [new Type(/* TTask */ 6, [a])])), new Type(/* TList */ 5, [a]))), singleton("tasks")]]);
20
+
21
+ function scheme(name) {
22
+ return find((tupledArg) => (tupledArg[0] === name), signatures)[1];
23
+ }
24
+
25
+ export const spawn = new ExternalFunction(2, "Task.spawn", scheme("Task.spawn"), (context, args) => {
8
26
  let matchResult, thunk;
9
27
  if (!isEmpty(args)) {
10
28
  if (isEmpty(tail(args))) {
@@ -22,11 +40,11 @@ export const spawn = new ExternalFunction("Task.spawn", new Scheme_1(singleton(0
22
40
  case 0:
23
41
  return context.SpawnTask(thunk);
24
42
  default:
25
- throw new Exception("Task.spawn expects (thunk)");
43
+ throw Operators_InvalidArg("args", "Task.spawn expects a thunk.");
26
44
  }
27
45
  }, 1);
28
46
 
29
- export const awaitTask = new ExternalFunction("Task.await", new Scheme_1(singleton(0), new Type(/* TFun */ 11, [new Type(/* TTask */ 6, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [0])])), (context, args) => {
47
+ export const awaitTask = new ExternalFunction(2, "Task.await", scheme("Task.await"), (context, args) => {
30
48
  let matchResult, value;
31
49
  if (!isEmpty(args)) {
32
50
  if (isEmpty(tail(args))) {
@@ -44,7 +62,33 @@ export const awaitTask = new ExternalFunction("Task.await", new Scheme_1(singlet
44
62
  case 0:
45
63
  return context.AwaitTask(value);
46
64
  default:
47
- throw new Exception("Task.await expects (task)");
65
+ throw Operators_InvalidArg("args", "Task.await expects a task.");
48
66
  }
49
67
  }, 1);
50
68
 
69
+ function operation(name) {
70
+ const target = new FSharpRef(defaultOf());
71
+ const patternInput = find((tupledArg) => (tupledArg[0] === name), signatures);
72
+ const descriptor = new ExternalFunction(2, name, patternInput[1], (context, args) => fold(context.Apply, new Value(/* VExternal */ 15, [target.contents, empty()]), args), length(patternInput[2]));
73
+ target.contents = descriptor;
74
+ return descriptor;
75
+ }
76
+
77
+ export const delay = operation("Task.delay");
78
+
79
+ export const fromResult = operation("Task.fromResult");
80
+
81
+ export const continueWith = operation("Task.continueWith");
82
+
83
+ export const whenAll = operation("Task.whenAll");
84
+
85
+ export const whenAny = operation("Task.whenAny");
86
+
87
+ export const awaitAll = operation("Task.awaitAll");
88
+
89
+ export const all = ofArray([spawn, awaitTask, delay, fromResult, continueWith, whenAll, whenAny, awaitAll]);
90
+
91
+ export function isCanonical(descriptor) {
92
+ return exists((candidate) => (candidate === descriptor), all);
93
+ }
94
+