@magnusopera/fscript 0.83.3 → 0.86.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.
package/README.md CHANGED
@@ -9,3 +9,7 @@ Provide complete environments with `registration({types, unions, functions})` an
9
9
  `HostFunctions.create({name, parameters, result, invoke})` builds a typed function from explicit script types. Handlers receive tagged arguments and an invocation context with `apply` for synchronous script callbacks. Existing `extern` declarations still work. Fable task execution and Promise-returning handlers are unsupported.
10
10
 
11
11
  See the [JavaScript hosting reference](https://fscript.magnusopera.io/manual/embedding/fable-javascript) for descriptor tables and examples. Run the local sample after building: `node examples/hosting.mjs`.
12
+
13
+ ## Exit status
14
+
15
+ JavaScript treats `Env.setExitCode` as a no-op for source portability. It does not change process status or enforce a shell-code range. Arguments are still evaluated normally, and the program's returned value is unchanged. The website continues displaying that value. Existing `run`, `evaluate`, and `invoke` APIs retain their tagged-value results.
@@ -1,21 +1,35 @@
1
1
 
2
2
  import { Union, Record } from "../fable_modules/fable-library-js.5.13.0/Types.js";
3
- import { float64_type, int64_type, union_type, record_type, option_type, list_type, tuple_type, bool_type, string_type } from "../fable_modules/fable-library-js.5.13.0/Reflection.js";
3
+ import { float64_type, int64_type, union_type, option_type, list_type, tuple_type, bool_type, record_type, string_type } from "../fable_modules/fable-library-js.5.13.0/Reflection.js";
4
4
  import { Span_$reflection } from "./Span.js";
5
5
 
6
+ export class BackendImport extends Record {
7
+ constructor(ModulePath, MemberName, Span) {
8
+ super();
9
+ this.ModulePath = ModulePath;
10
+ this.MemberName = MemberName;
11
+ this.Span = Span;
12
+ }
13
+ }
14
+
15
+ export function BackendImport_$reflection() {
16
+ return record_type("FScript.Language.BackendImport", [], BackendImport, () => [["ModulePath", string_type], ["MemberName", string_type], ["Span", Span_$reflection()]]);
17
+ }
18
+
6
19
  export class TypeDef extends Record {
7
- constructor(Name, IsRecursive, Fields, Cases, Span) {
20
+ constructor(Name, IsRecursive, Fields, Cases, Import, Span) {
8
21
  super();
9
22
  this.Name = Name;
10
23
  this.IsRecursive = IsRecursive;
11
24
  this.Fields = Fields;
12
25
  this.Cases = Cases;
26
+ this.Import = Import;
13
27
  this.Span = Span;
14
28
  }
15
29
  }
16
30
 
17
31
  export function TypeDef_$reflection() {
18
- return record_type("FScript.Language.TypeDef", [], TypeDef, () => [["Name", string_type], ["IsRecursive", bool_type], ["Fields", list_type(tuple_type(string_type, TypeRef_$reflection()))], ["Cases", list_type(tuple_type(string_type, option_type(TypeRef_$reflection())))], ["Span", Span_$reflection()]]);
32
+ return record_type("FScript.Language.TypeDef", [], TypeDef, () => [["Name", string_type], ["IsRecursive", bool_type], ["Fields", list_type(tuple_type(string_type, TypeRef_$reflection()))], ["Cases", list_type(tuple_type(string_type, option_type(TypeRef_$reflection())))], ["Import", option_type(BackendImport_$reflection())], ["Span", Span_$reflection()]]);
19
33
  }
20
34
 
21
35
  export class TypeRef extends Union {
@@ -46,6 +60,19 @@ export function Param_$reflection() {
46
60
  return record_type("FScript.Language.Param", [], Param, () => [["Name", string_type], ["Annotation", option_type(TypeRef_$reflection())], ["Span", Span_$reflection()]]);
47
61
  }
48
62
 
63
+ export class Attribute extends Record {
64
+ constructor(Name, Arguments, Span) {
65
+ super();
66
+ this.Name = Name;
67
+ this.Arguments = Arguments;
68
+ this.Span = Span;
69
+ }
70
+ }
71
+
72
+ export function Attribute_$reflection() {
73
+ return record_type("FScript.Language.Attribute", [], Attribute, () => [["Name", string_type], ["Arguments", list_type(string_type)], ["Span", Span_$reflection()]]);
74
+ }
75
+
49
76
  export class Literal extends Union {
50
77
  constructor(tag, fields) {
51
78
  super();
@@ -128,12 +155,12 @@ export class Stmt extends Union {
128
155
  this.fields = fields;
129
156
  }
130
157
  cases() {
131
- return ["SType", "SImport", "SLet", "SLetPattern", "SLetRecGroup", "SExpr"];
158
+ return ["SType", "SImport", "SLet", "SLetPattern", "SLetRecGroup", "SBackendImport", "SAttributed", "SExpr"];
132
159
  }
133
160
  }
134
161
 
135
162
  export function Stmt_$reflection() {
136
- return union_type("FScript.Language.Stmt", [], Stmt, () => [[["Item", TypeDef_$reflection()]], [["Item1", string_type], ["Item2", string_type], ["Item3", Span_$reflection()]], [["Item1", string_type], ["Item2", list_type(Param_$reflection())], ["Item3", option_type(TypeRef_$reflection())], ["Item4", Expr_$reflection()], ["Item5", bool_type], ["Item6", bool_type], ["Item7", Span_$reflection()]], [["Item1", Pattern_$reflection()], ["Item2", Expr_$reflection()], ["Item3", bool_type], ["Item4", Span_$reflection()]], [["Item1", list_type(tuple_type(string_type, list_type(Param_$reflection()), option_type(TypeRef_$reflection()), Expr_$reflection(), Span_$reflection()))], ["Item2", bool_type], ["Item3", Span_$reflection()]], [["Item", Expr_$reflection()]]]);
163
+ return union_type("FScript.Language.Stmt", [], Stmt, () => [[["Item", TypeDef_$reflection()]], [["Item1", string_type], ["Item2", string_type], ["Item3", Span_$reflection()]], [["Item1", string_type], ["Item2", list_type(Param_$reflection())], ["Item3", option_type(TypeRef_$reflection())], ["Item4", Expr_$reflection()], ["Item5", bool_type], ["Item6", bool_type], ["Item7", Span_$reflection()]], [["Item1", Pattern_$reflection()], ["Item2", Expr_$reflection()], ["Item3", bool_type], ["Item4", Span_$reflection()]], [["Item1", list_type(tuple_type(string_type, list_type(Param_$reflection()), option_type(TypeRef_$reflection()), Expr_$reflection(), Span_$reflection()))], ["Item2", bool_type], ["Item3", Span_$reflection()]], [["Item1", string_type], ["Item2", TypeRef_$reflection()], ["Item3", BackendImport_$reflection()], ["Item4", Span_$reflection()]], [["Item1", list_type(Attribute_$reflection())], ["Item2", Stmt_$reflection()], ["Item3", Span_$reflection()]], [["Item", Expr_$reflection()]]]);
137
164
  }
138
165
 
139
166
  export function Ast_spanOfPattern(pat) {
@@ -232,3 +259,53 @@ export function Ast_spanOfExpr(expr) {
232
259
  }
233
260
  }
234
261
 
262
+ export function Ast_spanOfStmt(statement) {
263
+ let matchResult, span;
264
+ switch (statement.tag) {
265
+ case 1: {
266
+ matchResult = 1;
267
+ span = statement.fields[2];
268
+ break;
269
+ }
270
+ case 2: {
271
+ matchResult = 1;
272
+ span = statement.fields[6];
273
+ break;
274
+ }
275
+ case 3: {
276
+ matchResult = 1;
277
+ span = statement.fields[3];
278
+ break;
279
+ }
280
+ case 4: {
281
+ matchResult = 1;
282
+ span = statement.fields[2];
283
+ break;
284
+ }
285
+ case 5: {
286
+ matchResult = 1;
287
+ span = statement.fields[3];
288
+ break;
289
+ }
290
+ case 6: {
291
+ matchResult = 1;
292
+ span = statement.fields[2];
293
+ break;
294
+ }
295
+ case 7: {
296
+ matchResult = 2;
297
+ break;
298
+ }
299
+ default:
300
+ matchResult = 0;
301
+ }
302
+ switch (matchResult) {
303
+ case 0:
304
+ return statement.fields[0].Span;
305
+ case 1:
306
+ return span;
307
+ default:
308
+ return Ast_spanOfExpr(statement.fields[0]);
309
+ }
310
+ }
311
+
@@ -788,7 +788,7 @@ const builtinStringReplace = new ExternalFunction("String.replace", scheme("Stri
788
788
  }
789
789
  switch (matchResult) {
790
790
  case 0:
791
- return new Value(/* VString */ 4, [replace(source, oldValue, newValue)]);
791
+ return new Value(/* VString */ 4, [(oldValue === "") ? source : replace(source, oldValue, newValue)]);
792
792
  default:
793
793
  return fail("String.replace expects (string, string, string)");
794
794
  }
@@ -3154,5 +3154,31 @@ const builtinMapRemove = new ExternalFunction("Map.remove", scheme("Map.remove")
3154
3154
  }
3155
3155
  }, 2);
3156
3156
 
3157
- export const builtinExterns = ofArray([builtinIgnore, builtinIntTryParse, builtinFloatTryParse, builtinBoolTryParse, builtinIntToString, builtinFloatToString, builtinBoolToString, builtinStringReplace, builtinStringIndexOf, builtinStringToLower, builtinStringToUpper, builtinStringSubstring, builtinStringConcat, builtinStringSplit, builtinStringEndsWith, builtinListEmpty, builtinListMap, builtinListIter, builtinListChoose, builtinListCollect, builtinListExists, builtinListContains, builtinListRev, builtinListDistinct, builtinListFold, builtinListFilter, builtinListLength, builtinListTryFind, builtinListTryGet, builtinListTryItem, builtinListTryHead, builtinListTail, builtinListAppend, builtinOptionDefaultValue, builtinOptionDefaultWith, builtinOptionIsNone, builtinOptionIsSome, builtinOptionMap, builtinMapEmpty, builtinMapTryGet, builtinMapContainsKey, builtinMapAdd, builtinMapOfList, builtinMapFold, builtinMapCount, builtinMapFilter, builtinMapChoose, builtinMapMap, builtinMapIter, builtinMapRemove]);
3157
+ const builtinSetExitCode = new ExternalFunction("Env.setExitCode", scheme("Env.setExitCode"), (context, _arg) => {
3158
+ let matchResult;
3159
+ if (!isEmpty(_arg)) {
3160
+ if (head_1(_arg).tag === 1) {
3161
+ if (isEmpty(tail_1(_arg))) {
3162
+ matchResult = 0;
3163
+ }
3164
+ else {
3165
+ matchResult = 1;
3166
+ }
3167
+ }
3168
+ else {
3169
+ matchResult = 1;
3170
+ }
3171
+ }
3172
+ else {
3173
+ matchResult = 1;
3174
+ }
3175
+ switch (matchResult) {
3176
+ case 0:
3177
+ return Value.VUnit;
3178
+ default:
3179
+ return fail("Env.setExitCode expects an integer.");
3180
+ }
3181
+ }, 1);
3182
+
3183
+ export const builtinExterns = ofArray([builtinSetExitCode, builtinIgnore, builtinIntTryParse, builtinFloatTryParse, builtinBoolTryParse, builtinIntToString, builtinFloatToString, builtinBoolToString, builtinStringReplace, builtinStringIndexOf, builtinStringToLower, builtinStringToUpper, builtinStringSubstring, builtinStringConcat, builtinStringSplit, builtinStringEndsWith, builtinListEmpty, builtinListMap, builtinListIter, builtinListChoose, builtinListCollect, builtinListExists, builtinListContains, builtinListRev, builtinListDistinct, builtinListFold, builtinListFilter, builtinListLength, builtinListTryFind, builtinListTryGet, builtinListTryItem, builtinListTryHead, builtinListTail, builtinListAppend, builtinOptionDefaultValue, builtinOptionDefaultWith, builtinOptionIsNone, builtinOptionIsSome, builtinOptionMap, builtinMapEmpty, builtinMapTryGet, builtinMapContainsKey, builtinMapAdd, builtinMapOfList, builtinMapFold, builtinMapCount, builtinMapFilter, builtinMapChoose, builtinMapMap, builtinMapIter, builtinMapRemove]);
3158
3184
 
@@ -1,18 +1,18 @@
1
1
 
2
2
  import { keys, ofList } from "../fable_modules/fable-library-js.5.13.0/Map.js";
3
- import { ofArray, empty, singleton } from "../fable_modules/fable-library-js.5.13.0/List.js";
3
+ import { ofArray, singleton, empty } from "../fable_modules/fable-library-js.5.13.0/List.js";
4
4
  import { Scheme, Type } from "./Types.js";
5
5
  import { comparePrimitives } from "../fable_modules/fable-library-js.5.13.0/Util.js";
6
6
  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(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])])])]))]]), {
10
+ export const builtinSchemes = ofList(ofArray([["Env.setExitCode", new Scheme(empty(), new Type(/* TFun */ 11, [Type.TInt, Type.TUnit]))], ["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
 
14
14
  export const builtinReservedNames = ofSeq(filter((name) => {
15
- if (startsWith(name, "List.", 4) ? true : startsWith(name, "Option.", 4)) {
15
+ if (((name === "Env.setExitCode") ? true : startsWith(name, "List.", 4)) ? true : startsWith(name, "Option.", 4)) {
16
16
  return true;
17
17
  }
18
18
  else {
@@ -5,9 +5,9 @@ import { empty, ofArray } from "../fable_modules/fable-library-js.5.13.0/List.js
5
5
 
6
6
  const unknownSpan = new Span(new Position(undefined, 0, 0), new Position(undefined, 0, 0));
7
7
 
8
- export const environmentType = new TypeDef("Environment", false, ofArray([["ScriptName", new TypeRef(/* TRPostfix */ 3, [new TypeRef(/* TRName */ 0, ["string"]), "option"])], ["Arguments", new TypeRef(/* TRPostfix */ 3, [new TypeRef(/* TRName */ 0, ["string"]), "list"])]]), empty(), unknownSpan);
8
+ export const environmentType = new TypeDef("Environment", false, ofArray([["ScriptName", new TypeRef(/* TRPostfix */ 3, [new TypeRef(/* TRName */ 0, ["string"]), "option"])], ["Arguments", new TypeRef(/* TRPostfix */ 3, [new TypeRef(/* TRName */ 0, ["string"]), "list"])]]), empty(), undefined, unknownSpan);
9
9
 
10
- export const fsKindType = new TypeDef("FsKind", false, empty(), ofArray([["File", new TypeRef(/* TRName */ 0, ["string"])], ["Directory", new TypeRef(/* TRName */ 0, ["string"])], ["Missing", undefined]]), unknownSpan);
10
+ export const fsKindType = new TypeDef("FsKind", false, empty(), ofArray([["File", new TypeRef(/* TRName */ 0, ["string"])], ["Directory", new TypeRef(/* TRName */ 0, ["string"])], ["Missing", undefined]]), undefined, unknownSpan);
11
11
 
12
12
  export const typeDefs = ofArray([environmentType, fsKindType]);
13
13