@magnusopera/fscript 0.92.4 → 0.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FScript.Language/Ast.js +27 -24
- package/dist/FScript.Language/BuiltinFunctions.js +273 -234
- package/dist/FScript.Language/BuiltinSignatures.js +1 -1
- package/dist/FScript.Language/BuiltinTypes.js +3 -5
- package/dist/FScript.Language/Eval.js +583 -532
- package/dist/FScript.Language/ExportSignatures.js +1 -1
- package/dist/FScript.Language/HostInterop.js +194 -116
- package/dist/FScript.Language/IncludeResolver.js +65 -55
- package/dist/FScript.Language/Lexer.js +175 -147
- package/dist/FScript.Language/MatchCoverage.js +12 -18
- package/dist/FScript.Language/Parser.js +561 -419
- package/dist/FScript.Language/Pretty.js +1 -1
- package/dist/FScript.Language/SupportLibrary.js +1 -1
- package/dist/FScript.Language/TaskFunctions.js +1 -1
- package/dist/FScript.Language/TaskSharingAnalysis.js +228 -202
- package/dist/FScript.Language/Token.js +55 -55
- package/dist/FScript.Language/TypeInfer.js +2767 -2027
- package/dist/FScript.Language/Types.js +312 -42
- package/dist/Library.js +8 -8
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { Record, Union } from "../fable_modules/fable-library-js.5.27.0/Types.js";
|
|
3
|
-
import { record_type, union_type, bool_type,
|
|
4
|
-
import { toList, isEmpty, ofList, difference,
|
|
5
|
-
import { Exception, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
|
|
6
|
-
import { empty as empty_1, fold, map } from "../fable_modules/fable-library-js.5.27.0/List.js";
|
|
7
|
-
import {
|
|
8
|
-
import { toList as toList_1, values } from "../fable_modules/fable-library-js.5.27.0/Map.js";
|
|
3
|
+
import { record_type, union_type, bool_type, option_type, int32_type, class_type, string_type, list_type } from "../fable_modules/fable-library-js.5.27.0/Reflection.js";
|
|
4
|
+
import { toList, isEmpty as isEmpty_1, singleton as singleton_1, ofList as ofList_1, difference, add, union, empty } from "../fable_modules/fable-library-js.5.27.0/Set.js";
|
|
5
|
+
import { uncurry2, Exception, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
|
|
6
|
+
import { empty as empty_1, length, zip, fold, head, tail, isEmpty, map as map_1, ofArray, singleton } from "../fable_modules/fable-library-js.5.27.0/List.js";
|
|
7
|
+
import { Operators_InvalidOp } from "../fable_modules/fable-library-js.5.27.0/FSharp.Core.js";
|
|
8
|
+
import { toList as toList_1, values, ofList, remove, FSharpMap__TryFind, map as map_2 } from "../fable_modules/fable-library-js.5.27.0/Map.js";
|
|
9
|
+
import { defaultArg } from "../fable_modules/fable-library-js.5.27.0/Option.js";
|
|
10
|
+
import { fold as fold_1, map as map_3 } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
|
|
9
11
|
import { join, printf, toText } from "../fable_modules/fable-library-js.5.27.0/String.js";
|
|
10
12
|
|
|
11
13
|
export class Type extends Union {
|
|
@@ -15,31 +17,32 @@ export class Type extends Union {
|
|
|
15
17
|
this.fields = fields;
|
|
16
18
|
}
|
|
17
19
|
cases() {
|
|
18
|
-
return ["TUnit", "TInt", "TFloat", "TBool", "TString", "TList", "TTask", "TTuple", "TRecord", "TMap", "TOption", "TFun", "TNamed", "TUnion", "TTypeToken", "TVar", "TNumeric", "THostManaged", "TRecordShape"];
|
|
20
|
+
return ["TUnit", "TInt", "TFloat", "TBool", "TString", "TList", "TTask", "TTuple", "TRecord", "TMap", "TOption", "TFun", "TNamed", "TApplied", "TGenericDefinition", "TUnion", "TTypeToken", "TVar", "TNumeric", "THostManaged", "TRecordShape"];
|
|
19
21
|
}
|
|
20
22
|
static TUnit = new Type(0, []);
|
|
21
23
|
static TInt = new Type(1, []);
|
|
22
24
|
static TFloat = new Type(2, []);
|
|
23
25
|
static TBool = new Type(3, []);
|
|
24
26
|
static TString = new Type(4, []);
|
|
25
|
-
static TTypeToken = new Type(
|
|
27
|
+
static TTypeToken = new Type(16, []);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export function Type_$reflection() {
|
|
29
|
-
return union_type("FScript.Language.Type", [], Type, () => [[], [], [], [], [], [["Item", Type_$reflection()]], [["Item", Type_$reflection()]], [["Item", list_type(Type_$reflection())]], [["Item", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])]], [["Item1", Type_$reflection()], ["Item2", Type_$reflection()]], [["Item", Type_$reflection()]], [["Item1", Type_$reflection()], ["Item2", Type_$reflection()]], [["Item", string_type]], [["Item1", string_type], ["Item2", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, option_type(Type_$reflection())])]], [], [["Item", int32_type]], [["Item", int32_type]], [["name", string_type], ["fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])]], [["id", int32_type], ["fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])], ["requiresConstruction", bool_type]]]);
|
|
31
|
+
return union_type("FScript.Language.Type", [], Type, () => [[], [], [], [], [], [["Item", Type_$reflection()]], [["Item", Type_$reflection()]], [["Item", list_type(Type_$reflection())]], [["Item", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])]], [["Item1", Type_$reflection()], ["Item2", Type_$reflection()]], [["Item", Type_$reflection()]], [["Item1", Type_$reflection()], ["Item2", Type_$reflection()]], [["Item", string_type]], [["name", string_type], ["arguments", list_type(Type_$reflection())]], [["parameters", list_type(int32_type)], ["body", Type_$reflection()]], [["Item1", string_type], ["Item2", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, option_type(Type_$reflection())])]], [], [["Item", int32_type]], [["Item", int32_type]], [["name", string_type], ["fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])]], [["id", int32_type], ["fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])], ["requiresConstruction", bool_type]]]);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export class HostTypeDescriptor extends Record {
|
|
33
|
-
constructor(Name, Fields, HostManaged) {
|
|
35
|
+
constructor(Name, Fields, HostManaged, TypeParameters) {
|
|
34
36
|
super();
|
|
35
37
|
this.Name = Name;
|
|
36
38
|
this.Fields = Fields;
|
|
37
39
|
this.HostManaged = HostManaged;
|
|
40
|
+
this.TypeParameters = TypeParameters;
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
export function HostTypeDescriptor_$reflection() {
|
|
42
|
-
return record_type("FScript.Language.HostTypeDescriptor", [], HostTypeDescriptor, () => [["Name", string_type], ["Fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])], ["HostManaged", bool_type]]);
|
|
45
|
+
return record_type("FScript.Language.HostTypeDescriptor", [], HostTypeDescriptor, () => [["Name", string_type], ["Fields", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])], ["HostManaged", bool_type], ["TypeParameters", list_type(int32_type)]]);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
@@ -99,19 +102,260 @@ let Types_nextId = 0;
|
|
|
99
102
|
export function Types_freshVar() {
|
|
100
103
|
const id = Types_nextId | 0;
|
|
101
104
|
Types_nextId = ((Types_nextId + 1) | 0);
|
|
102
|
-
return new Type(/* TVar */
|
|
105
|
+
return new Type(/* TVar */ 17, [id]);
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
export function Types_freshNumeric() {
|
|
106
109
|
const matchValue = Types_freshVar();
|
|
107
|
-
if (matchValue.tag ===
|
|
108
|
-
return new Type(/* TNumeric */
|
|
110
|
+
if (matchValue.tag === 17) {
|
|
111
|
+
return new Type(/* TNumeric */ 18, [matchValue.fields[0]]);
|
|
109
112
|
}
|
|
110
113
|
else {
|
|
111
114
|
throw new Exception("Expected fresh type variable");
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
export class Types_TypeConstructor extends Union {
|
|
119
|
+
constructor(tag, fields) {
|
|
120
|
+
super();
|
|
121
|
+
this.tag = tag;
|
|
122
|
+
this.fields = fields;
|
|
123
|
+
}
|
|
124
|
+
cases() {
|
|
125
|
+
return ["ListType", "OptionType", "TaskType", "MapType", "UserType"];
|
|
126
|
+
}
|
|
127
|
+
static ListType = new Types_TypeConstructor(0, []);
|
|
128
|
+
static OptionType = new Types_TypeConstructor(1, []);
|
|
129
|
+
static TaskType = new Types_TypeConstructor(2, []);
|
|
130
|
+
static MapType = new Types_TypeConstructor(3, []);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function Types_TypeConstructor_$reflection() {
|
|
134
|
+
return union_type("FScript.Language.Types.TypeConstructor", [], Types_TypeConstructor, () => [[], [], [], [], [["Item", string_type]]]);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function Types_$007CTypeApplication$007C_$007C(_arg) {
|
|
138
|
+
switch (_arg.tag) {
|
|
139
|
+
case 5:
|
|
140
|
+
return [Types_TypeConstructor.ListType, singleton(_arg.fields[0])];
|
|
141
|
+
case 10:
|
|
142
|
+
return [Types_TypeConstructor.OptionType, singleton(_arg.fields[0])];
|
|
143
|
+
case 6:
|
|
144
|
+
return [Types_TypeConstructor.TaskType, singleton(_arg.fields[0])];
|
|
145
|
+
case 9:
|
|
146
|
+
return [Types_TypeConstructor.MapType, ofArray([_arg.fields[0], _arg.fields[1]])];
|
|
147
|
+
case 13:
|
|
148
|
+
return [new Types_TypeConstructor(/* UserType */ 4, [_arg.fields[0]]), _arg.fields[1]];
|
|
149
|
+
default:
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function Types_mapChildren(map, _arg) {
|
|
155
|
+
const activePatternResult = Types_$007CTypeApplication$007C_$007C(_arg);
|
|
156
|
+
if (activePatternResult != null) {
|
|
157
|
+
const arguments$ = activePatternResult[1];
|
|
158
|
+
const constructor = activePatternResult[0];
|
|
159
|
+
const matchValue = map_1(map, arguments$);
|
|
160
|
+
let matchResult, item, item_1, item_2, key, value, arguments$_1, name;
|
|
161
|
+
switch (constructor.tag) {
|
|
162
|
+
case 1: {
|
|
163
|
+
if (!isEmpty(matchValue)) {
|
|
164
|
+
if (isEmpty(tail(matchValue))) {
|
|
165
|
+
matchResult = 1;
|
|
166
|
+
item_1 = head(matchValue);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
matchResult = 5;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
matchResult = 5;
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case 2: {
|
|
178
|
+
if (!isEmpty(matchValue)) {
|
|
179
|
+
if (isEmpty(tail(matchValue))) {
|
|
180
|
+
matchResult = 2;
|
|
181
|
+
item_2 = head(matchValue);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
matchResult = 5;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
matchResult = 5;
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
case 3: {
|
|
193
|
+
if (!isEmpty(matchValue)) {
|
|
194
|
+
if (!isEmpty(tail(matchValue))) {
|
|
195
|
+
if (isEmpty(tail(tail(matchValue)))) {
|
|
196
|
+
matchResult = 3;
|
|
197
|
+
key = head(matchValue);
|
|
198
|
+
value = head(tail(matchValue));
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
matchResult = 5;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
matchResult = 5;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
matchResult = 5;
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
case 4: {
|
|
214
|
+
matchResult = 4;
|
|
215
|
+
arguments$_1 = matchValue;
|
|
216
|
+
name = constructor.fields[0];
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
default:
|
|
220
|
+
if (!isEmpty(matchValue)) {
|
|
221
|
+
if (isEmpty(tail(matchValue))) {
|
|
222
|
+
matchResult = 0;
|
|
223
|
+
item = head(matchValue);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
matchResult = 5;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
matchResult = 5;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
switch (matchResult) {
|
|
234
|
+
case 0:
|
|
235
|
+
return new Type(/* TList */ 5, [item]);
|
|
236
|
+
case 1:
|
|
237
|
+
return new Type(/* TOption */ 10, [item_1]);
|
|
238
|
+
case 2:
|
|
239
|
+
return new Type(/* TTask */ 6, [item_2]);
|
|
240
|
+
case 3:
|
|
241
|
+
return new Type(/* TMap */ 9, [key, value]);
|
|
242
|
+
case 4:
|
|
243
|
+
return new Type(/* TApplied */ 13, [name, arguments$_1]);
|
|
244
|
+
default:
|
|
245
|
+
throw Operators_InvalidOp("Invalid type constructor arity");
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
switch (_arg.tag) {
|
|
250
|
+
case 7:
|
|
251
|
+
return new Type(/* TTuple */ 7, [map_1(map, _arg.fields[0])]);
|
|
252
|
+
case 11:
|
|
253
|
+
return new Type(/* TFun */ 11, [map(_arg.fields[0]), map(_arg.fields[1])]);
|
|
254
|
+
case 8:
|
|
255
|
+
return new Type(/* TRecord */ 8, [map_2(uncurry2((_arg_1) => map), _arg.fields[0])]);
|
|
256
|
+
case 20:
|
|
257
|
+
return new Type(/* TRecordShape */ 20, [_arg.fields[0], map_2(uncurry2((_arg_2) => map), _arg.fields[1]), _arg.fields[2]]);
|
|
258
|
+
case 15:
|
|
259
|
+
return new Type(/* TUnion */ 15, [_arg.fields[0], map_2((_arg_3, option) => {
|
|
260
|
+
const option_1 = option;
|
|
261
|
+
return (option_1 != null) ? map(option_1) : undefined;
|
|
262
|
+
}, _arg.fields[1])]);
|
|
263
|
+
default:
|
|
264
|
+
return _arg;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function Types_substitute(replacements, typ) {
|
|
270
|
+
let matchResult, id;
|
|
271
|
+
switch (typ.tag) {
|
|
272
|
+
case 17: {
|
|
273
|
+
matchResult = 0;
|
|
274
|
+
id = typ.fields[0];
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
case 18: {
|
|
278
|
+
matchResult = 0;
|
|
279
|
+
id = typ.fields[0];
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case 14: {
|
|
283
|
+
matchResult = 1;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
default:
|
|
287
|
+
matchResult = 2;
|
|
288
|
+
}
|
|
289
|
+
switch (matchResult) {
|
|
290
|
+
case 0:
|
|
291
|
+
return defaultArg(FSharpMap__TryFind(replacements, id), typ);
|
|
292
|
+
case 1: {
|
|
293
|
+
const parameters = typ.fields[0];
|
|
294
|
+
return new Type(/* TGenericDefinition */ 14, [parameters, Types_substitute(fold((state, parameter) => remove(parameter, state), replacements, parameters), typ.fields[1])]);
|
|
295
|
+
}
|
|
296
|
+
default:
|
|
297
|
+
return Types_mapChildren((typ_1) => Types_substitute(replacements, typ_1), typ);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export function Types_expand(definitions, typ) {
|
|
302
|
+
switch (typ.tag) {
|
|
303
|
+
case 12:
|
|
304
|
+
return defaultArg(FSharpMap__TryFind(definitions, typ.fields[0]), typ);
|
|
305
|
+
case 13: {
|
|
306
|
+
const arguments$ = typ.fields[1];
|
|
307
|
+
const matchValue = FSharpMap__TryFind(definitions, typ.fields[0]);
|
|
308
|
+
let matchResult, body_1, parameters_1;
|
|
309
|
+
if (matchValue != null) {
|
|
310
|
+
if (matchValue.tag === 14) {
|
|
311
|
+
if ((matchValue.fields[1], length(matchValue.fields[0]) === length(arguments$))) {
|
|
312
|
+
matchResult = 0;
|
|
313
|
+
body_1 = matchValue.fields[1];
|
|
314
|
+
parameters_1 = matchValue.fields[0];
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
matchResult = 1;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
matchResult = 1;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
matchResult = 1;
|
|
326
|
+
}
|
|
327
|
+
switch (matchResult) {
|
|
328
|
+
case 0:
|
|
329
|
+
return Types_substitute(ofList(zip(parameters_1, arguments$), {
|
|
330
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
331
|
+
}), body_1);
|
|
332
|
+
default:
|
|
333
|
+
return typ;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
default:
|
|
337
|
+
return typ;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function Types_definitionBody(_arg) {
|
|
342
|
+
if (_arg.tag === 14) {
|
|
343
|
+
return _arg.fields[1];
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
return _arg;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function Types_applied(name, _arg) {
|
|
351
|
+
if (_arg.tag === 14) {
|
|
352
|
+
return new Type(/* TApplied */ 13, [name, map_1((_arg_1) => Types_freshVar(), _arg.fields[0])]);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
return new Type(/* TNamed */ 12, [name]);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
115
359
|
export function Types_ftvType(t_mut) {
|
|
116
360
|
Types_ftvType:
|
|
117
361
|
while (true) {
|
|
@@ -131,11 +375,11 @@ export function Types_ftvType(t_mut) {
|
|
|
131
375
|
matchResult = 3;
|
|
132
376
|
break;
|
|
133
377
|
}
|
|
134
|
-
case
|
|
378
|
+
case 19: {
|
|
135
379
|
matchResult = 4;
|
|
136
380
|
break;
|
|
137
381
|
}
|
|
138
|
-
case
|
|
382
|
+
case 20: {
|
|
139
383
|
matchResult = 5;
|
|
140
384
|
break;
|
|
141
385
|
}
|
|
@@ -155,19 +399,27 @@ export function Types_ftvType(t_mut) {
|
|
|
155
399
|
matchResult = 9;
|
|
156
400
|
break;
|
|
157
401
|
}
|
|
158
|
-
case
|
|
159
|
-
case 13:
|
|
160
|
-
case 14: {
|
|
402
|
+
case 13: {
|
|
161
403
|
matchResult = 10;
|
|
162
404
|
break;
|
|
163
405
|
}
|
|
164
|
-
case
|
|
406
|
+
case 14: {
|
|
165
407
|
matchResult = 11;
|
|
166
|
-
v = t.fields[0];
|
|
167
408
|
break;
|
|
168
409
|
}
|
|
410
|
+
case 12:
|
|
411
|
+
case 15:
|
|
169
412
|
case 16: {
|
|
170
|
-
matchResult =
|
|
413
|
+
matchResult = 12;
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
case 17: {
|
|
417
|
+
matchResult = 13;
|
|
418
|
+
v = t.fields[0];
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
case 18: {
|
|
422
|
+
matchResult = 13;
|
|
171
423
|
v = t.fields[0];
|
|
172
424
|
break;
|
|
173
425
|
}
|
|
@@ -188,7 +440,7 @@ export function Types_ftvType(t_mut) {
|
|
|
188
440
|
continue Types_ftvType;
|
|
189
441
|
}
|
|
190
442
|
case 3: {
|
|
191
|
-
const list_1 =
|
|
443
|
+
const list_1 = map_1(Types_ftvType, t.fields[0]);
|
|
192
444
|
return fold(union, empty({
|
|
193
445
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
194
446
|
}), list_1);
|
|
@@ -198,11 +450,11 @@ export function Types_ftvType(t_mut) {
|
|
|
198
450
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
199
451
|
});
|
|
200
452
|
case 5:
|
|
201
|
-
return add(t.fields[0], (source_1 =
|
|
453
|
+
return add(t.fields[0], (source_1 = map_3(Types_ftvType, values(t.fields[1])), fold_1(union, empty({
|
|
202
454
|
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
203
455
|
}), source_1)));
|
|
204
456
|
case 6: {
|
|
205
|
-
const source_3 =
|
|
457
|
+
const source_3 = map_3(Types_ftvType, values(t.fields[0]));
|
|
206
458
|
return fold_1(union, empty({
|
|
207
459
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
208
460
|
}), source_3);
|
|
@@ -215,13 +467,23 @@ export function Types_ftvType(t_mut) {
|
|
|
215
467
|
}
|
|
216
468
|
case 9:
|
|
217
469
|
return union(Types_ftvType(t.fields[0]), Types_ftvType(t.fields[1]));
|
|
218
|
-
case 10:
|
|
219
|
-
|
|
470
|
+
case 10: {
|
|
471
|
+
const list_3 = map_1(Types_ftvType, t.fields[1]);
|
|
472
|
+
return fold(union, empty({
|
|
220
473
|
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
474
|
+
}), list_3);
|
|
475
|
+
}
|
|
476
|
+
case 11:
|
|
477
|
+
return difference(Types_ftvType(t.fields[1]), ofList_1(t.fields[0], {
|
|
478
|
+
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
479
|
+
}));
|
|
480
|
+
case 12:
|
|
481
|
+
return empty({
|
|
482
|
+
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
221
483
|
});
|
|
222
484
|
default:
|
|
223
|
-
return
|
|
224
|
-
Compare: (
|
|
485
|
+
return singleton_1(v, {
|
|
486
|
+
Compare: (x_8, y_8) => (comparePrimitives(x_8, y_8) | 0),
|
|
225
487
|
});
|
|
226
488
|
}
|
|
227
489
|
break;
|
|
@@ -229,13 +491,13 @@ export function Types_ftvType(t_mut) {
|
|
|
229
491
|
}
|
|
230
492
|
|
|
231
493
|
export function Types_ftvScheme(_arg) {
|
|
232
|
-
return difference(Types_ftvType(_arg.fields[1]),
|
|
494
|
+
return difference(Types_ftvType(_arg.fields[1]), ofList_1(_arg.fields[0], {
|
|
233
495
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
234
496
|
}));
|
|
235
497
|
}
|
|
236
498
|
|
|
237
499
|
export function Types_ftvEnv(env) {
|
|
238
|
-
const source_1 =
|
|
500
|
+
const source_1 = map_3(Types_ftvScheme, values(env));
|
|
239
501
|
return fold_1(union, empty({
|
|
240
502
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
241
503
|
}), source_1);
|
|
@@ -243,7 +505,7 @@ export function Types_ftvEnv(env) {
|
|
|
243
505
|
|
|
244
506
|
export function Types_generalize(env, t) {
|
|
245
507
|
const typeVariables = Types_ftvType(t);
|
|
246
|
-
if (
|
|
508
|
+
if (isEmpty_1(typeVariables)) {
|
|
247
509
|
return new Scheme(empty_1(), t);
|
|
248
510
|
}
|
|
249
511
|
else {
|
|
@@ -274,17 +536,17 @@ export function Types_typeToString(t) {
|
|
|
274
536
|
return toText(printf("%s task"))(arg_1);
|
|
275
537
|
}
|
|
276
538
|
case 7: {
|
|
277
|
-
const arg_2 = join(" * ",
|
|
539
|
+
const arg_2 = join(" * ", map_1(go, t_1.fields[0]));
|
|
278
540
|
return toText(printf("(%s)"))(arg_2);
|
|
279
541
|
}
|
|
280
|
-
case
|
|
542
|
+
case 19:
|
|
281
543
|
return t_1.fields[0];
|
|
282
|
-
case
|
|
544
|
+
case 20: {
|
|
283
545
|
t_1_mut = (new Type(/* TRecord */ 8, [t_1.fields[1]]));
|
|
284
546
|
continue go;
|
|
285
547
|
}
|
|
286
548
|
case 8: {
|
|
287
|
-
const arg_5 = join("; ",
|
|
549
|
+
const arg_5 = join("; ", map_1((tupledArg) => {
|
|
288
550
|
const arg_4 = go(tupledArg[1]);
|
|
289
551
|
return toText(printf("%s: %s"))(tupledArg[0])(arg_4);
|
|
290
552
|
}, toList_1(t_1.fields[0])));
|
|
@@ -314,13 +576,21 @@ export function Types_typeToString(t) {
|
|
|
314
576
|
}
|
|
315
577
|
case 12:
|
|
316
578
|
return t_1.fields[0];
|
|
317
|
-
case 13:
|
|
579
|
+
case 13: {
|
|
580
|
+
const arg_13 = join(", ", map_1(go, t_1.fields[1]));
|
|
581
|
+
return toText(printf("%s<%s>"))(t_1.fields[0])(arg_13);
|
|
582
|
+
}
|
|
583
|
+
case 14: {
|
|
584
|
+
t_1_mut = t_1.fields[1];
|
|
585
|
+
continue go;
|
|
586
|
+
}
|
|
587
|
+
case 15:
|
|
318
588
|
return t_1.fields[0];
|
|
319
|
-
case 14:
|
|
320
|
-
return "type";
|
|
321
589
|
case 16:
|
|
590
|
+
return "type";
|
|
591
|
+
case 18:
|
|
322
592
|
return "numeric";
|
|
323
|
-
case
|
|
593
|
+
case 17: {
|
|
324
594
|
const v = t_1.fields[0] | 0;
|
|
325
595
|
const letter = String.fromCharCode(~~(~~"a".charCodeAt(0) + (v % 26)) & 0xFFFF);
|
|
326
596
|
const suffix = ~~(v / 26) | 0;
|
|
@@ -342,8 +612,8 @@ export function Types_typeToString(t) {
|
|
|
342
612
|
case 11:
|
|
343
613
|
case 7:
|
|
344
614
|
case 8: {
|
|
345
|
-
const
|
|
346
|
-
return toText(printf("(%s)"))(
|
|
615
|
+
const arg_17 = go(t_3);
|
|
616
|
+
return toText(printf("(%s)"))(arg_17);
|
|
347
617
|
}
|
|
348
618
|
default:
|
|
349
619
|
return go(t_3);
|
package/dist/Library.js
CHANGED
|
@@ -632,7 +632,7 @@ function tagSignature(definitions_mut, expected_mut, value_mut, tagged_mut) {
|
|
|
632
632
|
}
|
|
633
633
|
break;
|
|
634
634
|
}
|
|
635
|
-
case
|
|
635
|
+
case 19: {
|
|
636
636
|
if (value.tag === 16) {
|
|
637
637
|
matchResult = 6;
|
|
638
638
|
host = value.fields[0];
|
|
@@ -643,7 +643,7 @@ function tagSignature(definitions_mut, expected_mut, value_mut, tagged_mut) {
|
|
|
643
643
|
}
|
|
644
644
|
break;
|
|
645
645
|
}
|
|
646
|
-
case
|
|
646
|
+
case 15: {
|
|
647
647
|
if (value.tag === 10) {
|
|
648
648
|
if (value.fields[2] != null) {
|
|
649
649
|
matchResult = 7;
|
|
@@ -1019,17 +1019,17 @@ function validateRegistration(registration_1) {
|
|
|
1019
1019
|
fields = t.fields[0];
|
|
1020
1020
|
break;
|
|
1021
1021
|
}
|
|
1022
|
-
case
|
|
1022
|
+
case 19: {
|
|
1023
1023
|
matchResult = 4;
|
|
1024
1024
|
fields = t.fields[1];
|
|
1025
1025
|
break;
|
|
1026
1026
|
}
|
|
1027
|
-
case
|
|
1027
|
+
case 20: {
|
|
1028
1028
|
matchResult = 4;
|
|
1029
1029
|
fields = t.fields[1];
|
|
1030
1030
|
break;
|
|
1031
1031
|
}
|
|
1032
|
-
case
|
|
1032
|
+
case 15: {
|
|
1033
1033
|
matchResult = 5;
|
|
1034
1034
|
cases = t.fields[1];
|
|
1035
1035
|
break;
|
|
@@ -1514,7 +1514,7 @@ export const T = {
|
|
|
1514
1514
|
string: Type.TString,
|
|
1515
1515
|
typeToken: Type.TTypeToken,
|
|
1516
1516
|
named: (name) => (new Type(/* TNamed */ 12, [name])),
|
|
1517
|
-
var: (value) => (new Type(/* TVar */
|
|
1517
|
+
var: (value) => (new Type(/* TVar */ 17, [intFromObj(value)])),
|
|
1518
1518
|
list: (value_1) => (new Type(/* TList */ 5, [value_1])),
|
|
1519
1519
|
task: (value_2) => (new Type(/* TTask */ 6, [value_2])),
|
|
1520
1520
|
option: (value_3) => (new Type(/* TOption */ 10, [value_3])),
|
|
@@ -1578,7 +1578,7 @@ function describeType(definition) {
|
|
|
1578
1578
|
else {
|
|
1579
1579
|
constructible = false;
|
|
1580
1580
|
}
|
|
1581
|
-
typeDefinitions(new ExtensionRegistration(empty_2.Permissions, singleton(new HostTypeDescriptor(name, fields_1, !constructible)), empty_2.Unions, empty_2.Functions), empty());
|
|
1581
|
+
typeDefinitions(new ExtensionRegistration(empty_2.Permissions, singleton(new HostTypeDescriptor(name, fields_1, !constructible, empty())), empty_2.Unions, empty_2.Functions), empty());
|
|
1582
1582
|
const _value_1 = {
|
|
1583
1583
|
name: name,
|
|
1584
1584
|
fields: (_value = propertiesObject(map((tupledArg) => [tupledArg[0], tupledArg[1]], toList(fields_1))), (() => { const visit = v => { if (v && typeof v === 'object' && !Object.isFrozen(v)) { for (const key of Object.keys(v)) visit(v[key]); Object.freeze(v); } }; visit(_value); return _value; })()),
|
|
@@ -1618,7 +1618,7 @@ export function registration(definition) {
|
|
|
1618
1618
|
};
|
|
1619
1619
|
const value_6 = validateRegistration(new ExtensionRegistration(0, map((d) => {
|
|
1620
1620
|
const d_1 = describeType(d);
|
|
1621
|
-
return new HostTypeDescriptor(d_1["name"], fieldTypes(d_1["fields"]), !(d_1["scriptConstructible"]));
|
|
1621
|
+
return new HostTypeDescriptor(d_1["name"], fieldTypes(d_1["fields"]), !(d_1["scriptConstructible"]), empty());
|
|
1622
1622
|
}, entries("types")), map((d_2) => {
|
|
1623
1623
|
const name_1 = getRequiredProperty("name", d_2);
|
|
1624
1624
|
const cases = getRequiredProperty("cases", d_2);
|