@magnusopera/fscript 0.79.0 → 0.80.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.
@@ -25,12 +25,12 @@ export class TypeRef extends Union {
25
25
  this.fields = fields;
26
26
  }
27
27
  cases() {
28
- return ["TRName", "TRTuple", "TRFun", "TRPostfix", "TRRecord", "TRStructuralRecord"];
28
+ return ["TRName", "TRTuple", "TRFun", "TRPostfix", "TRMap", "TRRecord", "TRStructuralRecord"];
29
29
  }
30
30
  }
31
31
 
32
32
  export function TypeRef_$reflection() {
33
- return union_type("FScript.Language.TypeRef", [], TypeRef, () => [[["Item", string_type]], [["Item", list_type(TypeRef_$reflection())]], [["Item1", TypeRef_$reflection()], ["Item2", TypeRef_$reflection()]], [["Item1", TypeRef_$reflection()], ["Item2", string_type]], [["Item", list_type(tuple_type(string_type, TypeRef_$reflection()))]], [["Item", list_type(tuple_type(string_type, TypeRef_$reflection()))]]]);
33
+ return union_type("FScript.Language.TypeRef", [], TypeRef, () => [[["Item", string_type]], [["Item", list_type(TypeRef_$reflection())]], [["Item1", TypeRef_$reflection()], ["Item2", TypeRef_$reflection()]], [["Item1", TypeRef_$reflection()], ["Item2", string_type]], [["Item1", TypeRef_$reflection()], ["Item2", TypeRef_$reflection()]], [["Item", list_type(tuple_type(string_type, TypeRef_$reflection()))]], [["Item", list_type(tuple_type(string_type, TypeRef_$reflection()))]]]);
34
34
  }
35
35
 
36
36
  export class Param extends Record {
@@ -228,11 +228,61 @@ function asStringList(functionName, values) {
228
228
  }
229
229
 
230
230
  function mapKeyToValue(key) {
231
- if (key.tag === 1) {
232
- return new Value_1(/* VInt */ 1, [key.fields[0]]);
231
+ switch (key.tag) {
232
+ case 1:
233
+ return new Value_1(/* VInt */ 1, [key.fields[0]]);
234
+ case 2:
235
+ return new Value_1(/* VBool */ 3, [key.fields[0]]);
236
+ case 3:
237
+ return new Value_1(/* VUnionCase */ 10, [key.fields[0], key.fields[1], undefined]);
238
+ default:
239
+ return new Value_1(/* VString */ 4, [key.fields[0]]);
233
240
  }
234
- else {
235
- return new Value_1(/* VString */ 4, [key.fields[0]]);
241
+ }
242
+
243
+ function valueToMapKey(functionName, value) {
244
+ let matchResult, key, key_1, key_2, caseName, typeName;
245
+ switch (value.tag) {
246
+ case 4: {
247
+ matchResult = 0;
248
+ key = value.fields[0];
249
+ break;
250
+ }
251
+ case 1: {
252
+ matchResult = 1;
253
+ key_1 = value.fields[0];
254
+ break;
255
+ }
256
+ case 3: {
257
+ matchResult = 2;
258
+ key_2 = value.fields[0];
259
+ break;
260
+ }
261
+ case 10: {
262
+ if (value.fields[2] == null) {
263
+ matchResult = 3;
264
+ caseName = value.fields[1];
265
+ typeName = value.fields[0];
266
+ }
267
+ else {
268
+ matchResult = 4;
269
+ }
270
+ break;
271
+ }
272
+ default:
273
+ matchResult = 4;
274
+ }
275
+ switch (matchResult) {
276
+ case 0:
277
+ return new MapKey(/* MKString */ 0, [key]);
278
+ case 1:
279
+ return new MapKey(/* MKInt */ 1, [key_1]);
280
+ case 2:
281
+ return new MapKey(/* MKBool */ 2, [key_2]);
282
+ case 3:
283
+ return new MapKey(/* MKUnionCase */ 3, [typeName, caseName]);
284
+ default:
285
+ return fail(`${functionName} expects a string, int, bool, or payload-free union key`);
236
286
  }
237
287
  }
238
288
 
@@ -1606,17 +1656,12 @@ const builtinMapEmpty = new ExternalFunction("Map.empty", scheme("Map.empty"), (
1606
1656
  const builtinMapTryGet = new ExternalFunction("Map.tryGet", scheme("Map.tryGet"), (_arg, args) => {
1607
1657
  let matchResult, key, values;
1608
1658
  if (!isEmpty(args)) {
1609
- if (head_1(args).tag === 4) {
1610
- if (!isEmpty(tail_1(args))) {
1611
- if (head_1(tail_1(args)).tag === 8) {
1612
- if (isEmpty(tail_1(tail_1(args)))) {
1613
- matchResult = 0;
1614
- key = head_1(args).fields[0];
1615
- values = head_1(tail_1(args)).fields[0];
1616
- }
1617
- else {
1618
- matchResult = 1;
1619
- }
1659
+ if (!isEmpty(tail_1(args))) {
1660
+ if (head_1(tail_1(args)).tag === 8) {
1661
+ if (isEmpty(tail_1(tail_1(args)))) {
1662
+ matchResult = 0;
1663
+ key = head_1(args);
1664
+ values = head_1(tail_1(args)).fields[0];
1620
1665
  }
1621
1666
  else {
1622
1667
  matchResult = 1;
@@ -1635,7 +1680,7 @@ const builtinMapTryGet = new ExternalFunction("Map.tryGet", scheme("Map.tryGet")
1635
1680
  }
1636
1681
  switch (matchResult) {
1637
1682
  case 0:
1638
- return new Value_1(/* VOption */ 9, [FSharpMap__TryFind(values, new MapKey(/* MKString */ 0, [key]))]);
1683
+ return new Value_1(/* VOption */ 9, [FSharpMap__TryFind(values, valueToMapKey("Map.tryGet", key))]);
1639
1684
  default:
1640
1685
  return fail("Map.tryGet expects (key, values)");
1641
1686
  }
@@ -1644,17 +1689,12 @@ const builtinMapTryGet = new ExternalFunction("Map.tryGet", scheme("Map.tryGet")
1644
1689
  const builtinMapContainsKey = new ExternalFunction("Map.containsKey", scheme("Map.containsKey"), (_arg, args) => {
1645
1690
  let matchResult, key, values;
1646
1691
  if (!isEmpty(args)) {
1647
- if (head_1(args).tag === 4) {
1648
- if (!isEmpty(tail_1(args))) {
1649
- if (head_1(tail_1(args)).tag === 8) {
1650
- if (isEmpty(tail_1(tail_1(args)))) {
1651
- matchResult = 0;
1652
- key = head_1(args).fields[0];
1653
- values = head_1(tail_1(args)).fields[0];
1654
- }
1655
- else {
1656
- matchResult = 1;
1657
- }
1692
+ if (!isEmpty(tail_1(args))) {
1693
+ if (head_1(tail_1(args)).tag === 8) {
1694
+ if (isEmpty(tail_1(tail_1(args)))) {
1695
+ matchResult = 0;
1696
+ key = head_1(args);
1697
+ values = head_1(tail_1(args)).fields[0];
1658
1698
  }
1659
1699
  else {
1660
1700
  matchResult = 1;
@@ -1673,7 +1713,7 @@ const builtinMapContainsKey = new ExternalFunction("Map.containsKey", scheme("Ma
1673
1713
  }
1674
1714
  switch (matchResult) {
1675
1715
  case 0:
1676
- return new Value_1(/* VBool */ 3, [FSharpMap__ContainsKey(values, new MapKey(/* MKString */ 0, [key]))]);
1716
+ return new Value_1(/* VBool */ 3, [FSharpMap__ContainsKey(values, valueToMapKey("Map.containsKey", key))]);
1677
1717
  default:
1678
1718
  return fail("Map.containsKey expects (key, values)");
1679
1719
  }
@@ -1682,19 +1722,14 @@ const builtinMapContainsKey = new ExternalFunction("Map.containsKey", scheme("Ma
1682
1722
  const builtinMapAdd = new ExternalFunction("Map.add", scheme("Map.add"), (_arg, args) => {
1683
1723
  let matchResult, key, value, values;
1684
1724
  if (!isEmpty(args)) {
1685
- if (head_1(args).tag === 4) {
1686
- if (!isEmpty(tail_1(args))) {
1687
- if (!isEmpty(tail_1(tail_1(args)))) {
1688
- if (head_1(tail_1(tail_1(args))).tag === 8) {
1689
- if (isEmpty(tail_1(tail_1(tail_1(args))))) {
1690
- matchResult = 0;
1691
- key = head_1(args).fields[0];
1692
- value = head_1(tail_1(args));
1693
- values = head_1(tail_1(tail_1(args))).fields[0];
1694
- }
1695
- else {
1696
- matchResult = 1;
1697
- }
1725
+ if (!isEmpty(tail_1(args))) {
1726
+ if (!isEmpty(tail_1(tail_1(args)))) {
1727
+ if (head_1(tail_1(tail_1(args))).tag === 8) {
1728
+ if (isEmpty(tail_1(tail_1(tail_1(args))))) {
1729
+ matchResult = 0;
1730
+ key = head_1(args);
1731
+ value = head_1(tail_1(args));
1732
+ values = head_1(tail_1(tail_1(args))).fields[0];
1698
1733
  }
1699
1734
  else {
1700
1735
  matchResult = 1;
@@ -1717,7 +1752,7 @@ const builtinMapAdd = new ExternalFunction("Map.add", scheme("Map.add"), (_arg,
1717
1752
  }
1718
1753
  switch (matchResult) {
1719
1754
  case 0:
1720
- return new Value_1(/* VMap */ 8, [FSharpMap__Add(values, new MapKey(/* MKString */ 0, [key]), value)]);
1755
+ return new Value_1(/* VMap */ 8, [FSharpMap__Add(values, valueToMapKey("Map.add", key), value)]);
1721
1756
  default:
1722
1757
  return fail("Map.add expects (key, value, values)");
1723
1758
  }
@@ -1748,16 +1783,11 @@ const builtinMapOfList = new ExternalFunction("Map.ofList", scheme("Map.ofList")
1748
1783
  let matchResult_1, key, value;
1749
1784
  if (entry.tag === 6) {
1750
1785
  if (!isEmpty(entry.fields[0])) {
1751
- if (head_1(entry.fields[0]).tag === 4) {
1752
- if (!isEmpty(tail_1(entry.fields[0]))) {
1753
- if (isEmpty(tail_1(tail_1(entry.fields[0])))) {
1754
- matchResult_1 = 0;
1755
- key = head_1(entry.fields[0]).fields[0];
1756
- value = head_1(tail_1(entry.fields[0]));
1757
- }
1758
- else {
1759
- matchResult_1 = 1;
1760
- }
1786
+ if (!isEmpty(tail_1(entry.fields[0]))) {
1787
+ if (isEmpty(tail_1(tail_1(entry.fields[0])))) {
1788
+ matchResult_1 = 0;
1789
+ key = head_1(entry.fields[0]);
1790
+ value = head_1(tail_1(entry.fields[0]));
1761
1791
  }
1762
1792
  else {
1763
1793
  matchResult_1 = 1;
@@ -1776,9 +1806,9 @@ const builtinMapOfList = new ExternalFunction("Map.ofList", scheme("Map.ofList")
1776
1806
  }
1777
1807
  switch (matchResult_1) {
1778
1808
  case 0:
1779
- return add(new MapKey(/* MKString */ 0, [key]), value, state);
1809
+ return add(valueToMapKey("Map.ofList", key), value, state);
1780
1810
  default:
1781
- return fail("Map.ofList expects [(string * value)]");
1811
+ return fail("Map.ofList expects [(key * value)]");
1782
1812
  }
1783
1813
  }, empty_1({
1784
1814
  Compare: (x, y) => (compare(x, y) | 0),
@@ -2001,17 +2031,12 @@ const builtinMapIter = new ExternalFunction("Map.iter", scheme("Map.iter"), (ctx
2001
2031
  const builtinMapRemove = new ExternalFunction("Map.remove", scheme("Map.remove"), (_arg, args) => {
2002
2032
  let matchResult, key, values;
2003
2033
  if (!isEmpty(args)) {
2004
- if (head_1(args).tag === 4) {
2005
- if (!isEmpty(tail_1(args))) {
2006
- if (head_1(tail_1(args)).tag === 8) {
2007
- if (isEmpty(tail_1(tail_1(args)))) {
2008
- matchResult = 0;
2009
- key = head_1(args).fields[0];
2010
- values = head_1(tail_1(args)).fields[0];
2011
- }
2012
- else {
2013
- matchResult = 1;
2014
- }
2034
+ if (!isEmpty(tail_1(args))) {
2035
+ if (head_1(tail_1(args)).tag === 8) {
2036
+ if (isEmpty(tail_1(tail_1(args)))) {
2037
+ matchResult = 0;
2038
+ key = head_1(args);
2039
+ values = head_1(tail_1(args)).fields[0];
2015
2040
  }
2016
2041
  else {
2017
2042
  matchResult = 1;
@@ -2030,7 +2055,7 @@ const builtinMapRemove = new ExternalFunction("Map.remove", scheme("Map.remove")
2030
2055
  }
2031
2056
  switch (matchResult) {
2032
2057
  case 0:
2033
- return new Value_1(/* VMap */ 8, [FSharpMap__Remove(values, new MapKey(/* MKString */ 0, [key]))]);
2058
+ return new Value_1(/* VMap */ 8, [FSharpMap__Remove(values, valueToMapKey("Map.remove", key))]);
2034
2059
  default:
2035
2060
  return fail("Map.remove expects (key, values)");
2036
2061
  }
@@ -7,7 +7,7 @@ import { ofSeq } from "../fable_modules/fable-library-js.5.13.0/Set.js";
7
7
  import { filter } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
8
8
  import { startsWith } from "../fable_modules/fable-library-js.5.13.0/String.js";
9
9
 
10
- export const builtinSchemes = ofList(ofArray([["ignore", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TUnit]))], ["Int.tryParse", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TInt])]))], ["Float.tryParse", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TFloat])]))], ["Bool.tryParse", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TBool])]))], ["Int.toString", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TInt, Type.TString]))], ["Float.toString", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TFloat, Type.TString]))], ["Bool.toString", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TBool, Type.TString]))], ["String.replace", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, Type.TString])])]))], ["String.indexOf", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TInt])])]))], ["String.toLower", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, Type.TString]))], ["String.toUpper", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, Type.TString]))], ["String.substring", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TInt, new Type(/* TFun */ 11, [Type.TInt, new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TString])])])]))], ["String.concat", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TList */ 5, [Type.TString]), Type.TString])]))], ["String.split", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, new Type(/* TList */ 5, [Type.TString])])]))], ["String.endsWith", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, Type.TBool])]))], ["List.empty", new Scheme(singleton(0), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]))], ["List.map", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])])]))], ["List.iter", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TUnit]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TUnit])]))], ["List.choose", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [1])])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])])]))], ["List.collect", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])])]))], ["List.exists", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TBool])]))], ["List.contains", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TBool])]))], ["List.rev", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])]))], ["List.distinct", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])]))], ["List.fold", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])])]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [1])])])]))], ["List.filter", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])])]))], ["List.length", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TInt]))], ["List.tryFind", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])])]))], ["List.tryGet", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [Type.TInt])])]))], ["List.tryItem", new Scheme(singleton(0), new Type(/* TFun */ 11, [Type.TInt, new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])])]))], ["List.tryHead", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])]))], ["List.tail", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])]))], ["List.append", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])])]))], ["Option.defaultValue", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [0])])]))], ["Option.defaultWith", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TUnit, new Type(/* TVar */ 15, [0])]), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [0])])]))], ["Option.isNone", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), Type.TBool]))], ["Option.isSome", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), Type.TBool]))], ["Option.map", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])]), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [1])])])]))], ["Map.empty", new Scheme(singleton(0), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]))], ["Map.tryGet", new Scheme(singleton(0), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])])]))], ["Map.containsKey", new Scheme(singleton(0), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), Type.TBool])]))], ["Map.add", new Scheme(singleton(0), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])])])])]))], ["Map.ofList", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TTuple */ 7, [ofArray([Type.TString, new Type(/* TVar */ 15, [0])])])]), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])])]))], ["Map.fold", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])])])]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [1])])])]))], ["Map.count", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), Type.TInt]))], ["Map.filter", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])])])]))], ["Map.choose", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [1])])])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [1])])])]))], ["Map.map", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [1])])])]))], ["Map.iter", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TUnit])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), Type.TUnit])]))], ["Map.remove", new Scheme(singleton(0), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [Type.TString, new Type(/* TVar */ 15, [0])])])]))]]), {
10
+ export const builtinSchemes = ofList(ofArray([["ignore", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TUnit]))], ["Int.tryParse", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TInt])]))], ["Float.tryParse", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TFloat])]))], ["Bool.tryParse", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TBool])]))], ["Int.toString", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TInt, Type.TString]))], ["Float.toString", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TFloat, Type.TString]))], ["Bool.toString", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TBool, Type.TString]))], ["String.replace", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, Type.TString])])]))], ["String.indexOf", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TInt])])]))], ["String.toLower", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, Type.TString]))], ["String.toUpper", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, Type.TString]))], ["String.substring", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TInt, new Type(/* TFun */ 11, [Type.TInt, new Type(/* TFun */ 11, [Type.TString, new Type(/* TOption */ 10, [Type.TString])])])]))], ["String.concat", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [new Type(/* TList */ 5, [Type.TString]), Type.TString])]))], ["String.split", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, new Type(/* TList */ 5, [Type.TString])])]))], ["String.endsWith", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TString, new Type(/* TFun */ 11, [Type.TString, Type.TBool])]))], ["List.empty", new Scheme(singleton(0), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]))], ["List.map", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])])]))], ["List.iter", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TUnit]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TUnit])]))], ["List.choose", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [1])])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])])]))], ["List.collect", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [1])])])]))], ["List.exists", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TBool])]))], ["List.contains", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TBool])]))], ["List.rev", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])]))], ["List.distinct", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])]))], ["List.fold", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])])]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [1])])])]))], ["List.filter", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])])]))], ["List.length", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), Type.TInt]))], ["List.tryFind", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])])]))], ["List.tryGet", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [Type.TInt])])]))], ["List.tryItem", new Scheme(singleton(0), new Type(/* TFun */ 11, [Type.TInt, new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])])]))], ["List.tryHead", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])]))], ["List.tail", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])]))], ["List.append", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])]), new Type(/* TList */ 5, [new Type(/* TVar */ 15, [0])])])]))], ["Option.defaultValue", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [0])])]))], ["Option.defaultWith", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TUnit, new Type(/* TVar */ 15, [0])]), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [0])])]))], ["Option.isNone", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), Type.TBool]))], ["Option.isSome", new Scheme(singleton(0), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), Type.TBool]))], ["Option.map", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [1])]), new Type(/* TFun */ 11, [new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [1])])])]))], ["Map.empty", new Scheme(ofArray([0, 1]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]))], ["Map.tryGet", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [0])])])]))], ["Map.containsKey", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), Type.TBool])]))], ["Map.add", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])])])])]))], ["Map.ofList", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TList */ 5, [new Type(/* TTuple */ 7, [ofArray([new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])])])]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])])]))], ["Map.fold", new Scheme(ofArray([0, 1, 2]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [2]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [2])])])]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [2]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [2])])])]))], ["Map.count", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), Type.TInt]))], ["Map.filter", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TBool])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])])])]))], ["Map.choose", new Scheme(ofArray([0, 1, 2]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TOption */ 10, [new Type(/* TVar */ 15, [2])])])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [2])])])]))], ["Map.map", new Scheme(ofArray([0, 1, 2]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), new Type(/* TVar */ 15, [2])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [2])])])]))], ["Map.iter", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [0]), Type.TUnit])]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), Type.TUnit])]))], ["Map.remove", new Scheme(ofArray([0, 1]), new Type(/* TFun */ 11, [new Type(/* TVar */ 15, [1]), new Type(/* TFun */ 11, [new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])]), new Type(/* TMap */ 9, [new Type(/* TVar */ 15, [1]), new Type(/* TVar */ 15, [0])])])]))]]), {
11
11
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
12
12
  });
13
13