@magnusopera/fscript 0.82.2 → 0.83.1

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.
@@ -0,0 +1,513 @@
1
+
2
+ import { Record, Union } from "../fable_modules/fable-library-js.5.13.0/Types.js";
3
+ import { record_type, union_type, class_type, lambda_type, unit_type } from "../fable_modules/fable-library-js.5.13.0/Reflection.js";
4
+ import { Exception, disposeSafe, getEnumerator, defaultOf } from "../fable_modules/fable-library-js.5.13.0/Util.js";
5
+ import { FSharpChoice$2 } from "../fable_modules/fable-library-js.5.13.0/Choice.js";
6
+ import { value as value_11, some, defaultArg } from "../fable_modules/fable-library-js.5.13.0/Option.js";
7
+ import { cons, empty, singleton, ofSeq, ofArray, head as head_1, tail as tail_1, isEmpty } from "../fable_modules/fable-library-js.5.13.0/List.js";
8
+
9
+ /**
10
+ * Continuations and exception scopes are data, rather than suspended CLR stacks.
11
+ */
12
+ export class Instruction extends Union {
13
+ constructor(tag, fields) {
14
+ super();
15
+ this.tag = tag;
16
+ this.fields = fields;
17
+ }
18
+ cases() {
19
+ return ["Finished", "Execute", "PushHandler", "PopHandler"];
20
+ }
21
+ static Finished = new Instruction(0, []);
22
+ }
23
+
24
+ export function Instruction_$reflection() {
25
+ return union_type("FScript.Language.Instruction", [], Instruction, () => [[], [["Item", lambda_type(unit_type, Instruction_$reflection())]], [["Item1", lambda_type(class_type("System.Exception"), Instruction_$reflection())], ["Item2", lambda_type(unit_type, Instruction_$reflection())]], [["Item", lambda_type(unit_type, Instruction_$reflection())]]]);
26
+ }
27
+
28
+ export class Execution$1 extends Record {
29
+ constructor(Value, Resume) {
30
+ super();
31
+ this.Value = Value;
32
+ this.Resume = Resume;
33
+ }
34
+ }
35
+
36
+ export function Execution$1_$reflection(gen0) {
37
+ return record_type("FScript.Language.Execution`1", [gen0], Execution$1, () => [["Value", gen0], ["Resume", lambda_type(lambda_type(gen0, Instruction_$reflection()), Instruction_$reflection())]]);
38
+ }
39
+
40
+ export function Execution$1__get_IsImmediate(this$) {
41
+ return this$.Resume === defaultOf();
42
+ }
43
+
44
+ export function Execution_protect(handler, body) {
45
+ if (Execution$1__get_IsImmediate(body)) {
46
+ return body;
47
+ }
48
+ else {
49
+ return new Execution$1(defaultOf(), (continuation) => (new Instruction(/* PushHandler */ 2, [(error) => {
50
+ const execution = handler(error);
51
+ const continuation_1 = continuation;
52
+ return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
53
+ }, () => {
54
+ const execution_1 = body;
55
+ return Execution$1__get_IsImmediate(execution_1) ? (new Instruction(/* PopHandler */ 3, [() => continuation(execution_1.Value)])) : execution_1.Resume((value) => (new Instruction(/* PopHandler */ 3, [() => continuation(value)])));
56
+ }])));
57
+ }
58
+ }
59
+
60
+ export function Execution_finish(cleanup, body) {
61
+ if (Execution$1__get_IsImmediate(body)) {
62
+ cleanup();
63
+ return body;
64
+ }
65
+ else {
66
+ return new Execution$1(defaultOf(), (continuation) => (new Instruction(/* PushHandler */ 2, [(error) => {
67
+ cleanup();
68
+ throw error;
69
+ }, () => {
70
+ const execution = body;
71
+ return Execution$1__get_IsImmediate(execution) ? (new Instruction(/* PopHandler */ 3, [() => {
72
+ cleanup();
73
+ return continuation(execution.Value);
74
+ }])) : execution.Resume((value) => (new Instruction(/* PopHandler */ 3, [() => {
75
+ cleanup();
76
+ return continuation(value);
77
+ }])));
78
+ }])));
79
+ }
80
+ }
81
+
82
+ export class Execution_Builder {
83
+ constructor() {
84
+ }
85
+ }
86
+
87
+ export function Execution_Builder_$reflection() {
88
+ return class_type("FScript.Language.Execution.Builder", undefined, Execution_Builder);
89
+ }
90
+
91
+ export function Execution_Builder_$ctor() {
92
+ return new Execution_Builder();
93
+ }
94
+
95
+ export function Execution_Builder__TryWith_1CEB6EA5(_, body, handler) {
96
+ let first;
97
+ try {
98
+ first = (new FSharpChoice$2(/* Choice1Of2 */ 0, [body()]));
99
+ }
100
+ catch (error) {
101
+ first = (new FSharpChoice$2(/* Choice2Of2 */ 1, [error]));
102
+ }
103
+ if (first.tag === 1) {
104
+ return handler(first.fields[0]);
105
+ }
106
+ else {
107
+ return Execution_protect(handler, first.fields[0]);
108
+ }
109
+ }
110
+
111
+ export function Execution_Builder__TryFinally_737CA081(_, body, cleanup) {
112
+ return Execution_finish(cleanup, (() => {
113
+ try {
114
+ return body();
115
+ }
116
+ catch (error) {
117
+ cleanup();
118
+ throw error;
119
+ }
120
+ })());
121
+ }
122
+
123
+ export function Execution_Builder__While_3CDDC188(this$, condition, body) {
124
+ let pending = undefined;
125
+ while ((pending == null) && condition()) {
126
+ let body_1;
127
+ const next = body();
128
+ if (!Execution$1__get_IsImmediate(next)) {
129
+ pending = ((body_1 = next, Execution$1__get_IsImmediate(body_1) ? Execution_Builder__While_3CDDC188(this$, condition, body) : (new Execution$1(defaultOf(), (continuation) => {
130
+ const execution_1 = body_1;
131
+ if (Execution$1__get_IsImmediate(execution_1)) {
132
+ const execution = Execution_Builder__While_3CDDC188(this$, condition, body);
133
+ const continuation_1 = continuation;
134
+ if (Execution$1__get_IsImmediate(execution)) {
135
+ return continuation_1(execution.Value);
136
+ }
137
+ else {
138
+ return execution.Resume(continuation_1);
139
+ }
140
+ }
141
+ else {
142
+ return execution_1.Resume((value) => {
143
+ const execution = Execution_Builder__While_3CDDC188(this$, condition, body);
144
+ const continuation_1 = continuation;
145
+ return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
146
+ });
147
+ }
148
+ }))));
149
+ }
150
+ }
151
+ return defaultArg(pending, new Execution$1(undefined, defaultOf()));
152
+ }
153
+
154
+ export function Execution_Builder__For_Z3A5BE4A(_, items, body) {
155
+ const loop = (remaining_mut) => {
156
+ loop:
157
+ while (true) {
158
+ const remaining = remaining_mut;
159
+ if (!isEmpty(remaining)) {
160
+ const tail = tail_1(remaining);
161
+ const next = body(head_1(remaining));
162
+ if (Execution$1__get_IsImmediate(next)) {
163
+ remaining_mut = tail;
164
+ continue loop;
165
+ }
166
+ else {
167
+ const body_1 = next;
168
+ if (Execution$1__get_IsImmediate(body_1)) {
169
+ remaining_mut = tail;
170
+ continue loop;
171
+ }
172
+ else {
173
+ return new Execution$1(defaultOf(), (continuation) => {
174
+ const execution_1 = body_1;
175
+ if (Execution$1__get_IsImmediate(execution_1)) {
176
+ const execution = loop(tail);
177
+ const continuation_1 = continuation;
178
+ if (Execution$1__get_IsImmediate(execution)) {
179
+ return continuation_1(execution.Value);
180
+ }
181
+ else {
182
+ return execution.Resume(continuation_1);
183
+ }
184
+ }
185
+ else {
186
+ return execution_1.Resume((value_1) => {
187
+ const execution = loop(tail);
188
+ const continuation_1 = continuation;
189
+ return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
190
+ });
191
+ }
192
+ });
193
+ }
194
+ }
195
+ }
196
+ else {
197
+ return new Execution$1(undefined, defaultOf());
198
+ }
199
+ break;
200
+ }
201
+ };
202
+ return loop(items);
203
+ }
204
+
205
+ export function Execution_Builder__For_99EF8BD(this$, items, body) {
206
+ const iterator = getEnumerator(items);
207
+ return Execution_Builder__TryFinally_737CA081(this$, () => Execution_Builder__While_3CDDC188(this$, () => iterator["System.Collections.IEnumerator.MoveNext"](), () => body(iterator["System.Collections.Generic.IEnumerator`1.get_Current"]())), () => {
208
+ disposeSafe(iterator);
209
+ });
210
+ }
211
+
212
+ export const Execution_execution = Execution_Builder_$ctor();
213
+
214
+ export function Execution_map(mapper, items) {
215
+ if (!isEmpty(items)) {
216
+ if (!isEmpty(tail_1(items))) {
217
+ if (isEmpty(tail_1(tail_1(items)))) {
218
+ const body_4 = mapper(head_1(items));
219
+ if (Execution$1__get_IsImmediate(body_4)) {
220
+ const a = body_4.Value;
221
+ const body_2 = mapper(head_1(tail_1(items)));
222
+ if (Execution$1__get_IsImmediate(body_2)) {
223
+ return new Execution$1(ofArray([a, body_2.Value]), defaultOf());
224
+ }
225
+ else {
226
+ return new Execution$1(defaultOf(), (continuation_3) => {
227
+ const execution_3 = body_2;
228
+ if (Execution$1__get_IsImmediate(execution_3)) {
229
+ const execution_2 = new Execution$1(ofArray([a, execution_3.Value]), defaultOf());
230
+ const continuation_4 = continuation_3;
231
+ if (Execution$1__get_IsImmediate(execution_2)) {
232
+ return continuation_4(execution_2.Value);
233
+ }
234
+ else {
235
+ return execution_2.Resume(continuation_4);
236
+ }
237
+ }
238
+ else {
239
+ return execution_3.Resume((value_6) => {
240
+ const execution_2 = new Execution$1(ofArray([a, value_6]), defaultOf());
241
+ const continuation_4 = continuation_3;
242
+ return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
243
+ });
244
+ }
245
+ });
246
+ }
247
+ }
248
+ else {
249
+ return new Execution$1(defaultOf(), (continuation_6) => {
250
+ const execution_5 = body_4;
251
+ if (Execution$1__get_IsImmediate(execution_5)) {
252
+ let execution_4;
253
+ const a = execution_5.Value;
254
+ const body_2 = mapper(head_1(tail_1(items)));
255
+ execution_4 = (Execution$1__get_IsImmediate(body_2) ? (new Execution$1(ofArray([a, body_2.Value]), defaultOf())) : (new Execution$1(defaultOf(), (continuation_3) => {
256
+ const execution_3 = body_2;
257
+ if (Execution$1__get_IsImmediate(execution_3)) {
258
+ const execution_2 = new Execution$1(ofArray([a, execution_3.Value]), defaultOf());
259
+ const continuation_4 = continuation_3;
260
+ if (Execution$1__get_IsImmediate(execution_2)) {
261
+ return continuation_4(execution_2.Value);
262
+ }
263
+ else {
264
+ return execution_2.Resume(continuation_4);
265
+ }
266
+ }
267
+ else {
268
+ return execution_3.Resume((value_6) => {
269
+ const execution_2 = new Execution$1(ofArray([a, value_6]), defaultOf());
270
+ const continuation_4 = continuation_3;
271
+ return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
272
+ });
273
+ }
274
+ })));
275
+ const continuation_7 = continuation_6;
276
+ if (Execution$1__get_IsImmediate(execution_4)) {
277
+ return continuation_7(execution_4.Value);
278
+ }
279
+ else {
280
+ return execution_4.Resume(continuation_7);
281
+ }
282
+ }
283
+ else {
284
+ return execution_5.Resume((value_7) => {
285
+ let execution_4;
286
+ const a = value_7;
287
+ const body_2 = mapper(head_1(tail_1(items)));
288
+ execution_4 = (Execution$1__get_IsImmediate(body_2) ? (new Execution$1(ofArray([a, body_2.Value]), defaultOf())) : (new Execution$1(defaultOf(), (continuation_3) => {
289
+ const execution_3 = body_2;
290
+ if (Execution$1__get_IsImmediate(execution_3)) {
291
+ const execution_2 = new Execution$1(ofArray([a, execution_3.Value]), defaultOf());
292
+ const continuation_4 = continuation_3;
293
+ if (Execution$1__get_IsImmediate(execution_2)) {
294
+ return continuation_4(execution_2.Value);
295
+ }
296
+ else {
297
+ return execution_2.Resume(continuation_4);
298
+ }
299
+ }
300
+ else {
301
+ return execution_3.Resume((value_6) => {
302
+ const execution_2 = new Execution$1(ofArray([a, value_6]), defaultOf());
303
+ const continuation_4 = continuation_3;
304
+ return Execution$1__get_IsImmediate(execution_2) ? continuation_4(execution_2.Value) : execution_2.Resume(continuation_4);
305
+ });
306
+ }
307
+ })));
308
+ const continuation_7 = continuation_6;
309
+ return Execution$1__get_IsImmediate(execution_4) ? continuation_7(execution_4.Value) : execution_4.Resume(continuation_7);
310
+ });
311
+ }
312
+ });
313
+ }
314
+ }
315
+ else {
316
+ const output = [];
317
+ const loop = (remaining_mut) => {
318
+ loop:
319
+ while (true) {
320
+ const remaining = remaining_mut;
321
+ if (!isEmpty(remaining)) {
322
+ const tail = tail_1(remaining);
323
+ const next = mapper(head_1(remaining));
324
+ if (Execution$1__get_IsImmediate(next)) {
325
+ void (output.push(next.Value));
326
+ remaining_mut = tail;
327
+ continue loop;
328
+ }
329
+ else {
330
+ const body_5 = next;
331
+ if (Execution$1__get_IsImmediate(body_5)) {
332
+ void (output.push(body_5.Value));
333
+ remaining_mut = tail;
334
+ continue loop;
335
+ }
336
+ else {
337
+ return new Execution$1(defaultOf(), (continuation_9) => {
338
+ const execution_7 = body_5;
339
+ if (Execution$1__get_IsImmediate(execution_7)) {
340
+ let execution_6;
341
+ void (output.push(execution_7.Value));
342
+ execution_6 = loop(tail);
343
+ const continuation_10 = continuation_9;
344
+ if (Execution$1__get_IsImmediate(execution_6)) {
345
+ return continuation_10(execution_6.Value);
346
+ }
347
+ else {
348
+ return execution_6.Resume(continuation_10);
349
+ }
350
+ }
351
+ else {
352
+ return execution_7.Resume((value_10) => {
353
+ let execution_6;
354
+ void (output.push(value_10));
355
+ execution_6 = loop(tail);
356
+ const continuation_10 = continuation_9;
357
+ return Execution$1__get_IsImmediate(execution_6) ? continuation_10(execution_6.Value) : execution_6.Resume(continuation_10);
358
+ });
359
+ }
360
+ });
361
+ }
362
+ }
363
+ }
364
+ else {
365
+ return new Execution$1(ofSeq(output), defaultOf());
366
+ }
367
+ break;
368
+ }
369
+ };
370
+ return loop(items);
371
+ }
372
+ }
373
+ else {
374
+ const body = mapper(head_1(items));
375
+ if (Execution$1__get_IsImmediate(body)) {
376
+ return new Execution$1(singleton(body.Value), defaultOf());
377
+ }
378
+ else {
379
+ return new Execution$1(defaultOf(), (continuation) => {
380
+ const execution_1 = body;
381
+ if (Execution$1__get_IsImmediate(execution_1)) {
382
+ const execution = new Execution$1(singleton(execution_1.Value), defaultOf());
383
+ const continuation_1 = continuation;
384
+ if (Execution$1__get_IsImmediate(execution)) {
385
+ return continuation_1(execution.Value);
386
+ }
387
+ else {
388
+ return execution.Resume(continuation_1);
389
+ }
390
+ }
391
+ else {
392
+ return execution_1.Resume((value_3) => {
393
+ const execution = new Execution$1(singleton(value_3), defaultOf());
394
+ const continuation_1 = continuation;
395
+ return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
396
+ });
397
+ }
398
+ });
399
+ }
400
+ }
401
+ }
402
+ else {
403
+ return new Execution$1(empty(), defaultOf());
404
+ }
405
+ }
406
+
407
+ export function Execution_fold(folder_mut, state_mut, items_mut) {
408
+ Execution_fold:
409
+ while (true) {
410
+ const folder = folder_mut, state = state_mut, items = items_mut;
411
+ if (!isEmpty(items)) {
412
+ const tail = tail_1(items);
413
+ const next = folder(state, head_1(items));
414
+ if (Execution$1__get_IsImmediate(next)) {
415
+ folder_mut = folder;
416
+ state_mut = next.Value;
417
+ items_mut = tail;
418
+ continue Execution_fold;
419
+ }
420
+ else {
421
+ const body = next;
422
+ if (Execution$1__get_IsImmediate(body)) {
423
+ folder_mut = folder;
424
+ state_mut = body.Value;
425
+ items_mut = tail;
426
+ continue Execution_fold;
427
+ }
428
+ else {
429
+ return new Execution$1(defaultOf(), (continuation) => {
430
+ const execution_1 = body;
431
+ if (Execution$1__get_IsImmediate(execution_1)) {
432
+ const execution = Execution_fold(folder, execution_1.Value, tail);
433
+ const continuation_1 = continuation;
434
+ if (Execution$1__get_IsImmediate(execution)) {
435
+ return continuation_1(execution.Value);
436
+ }
437
+ else {
438
+ return execution.Resume(continuation_1);
439
+ }
440
+ }
441
+ else {
442
+ return execution_1.Resume((value_2) => {
443
+ const execution = Execution_fold(folder, value_2, tail);
444
+ const continuation_1 = continuation;
445
+ return Execution$1__get_IsImmediate(execution) ? continuation_1(execution.Value) : execution.Resume(continuation_1);
446
+ });
447
+ }
448
+ });
449
+ }
450
+ }
451
+ }
452
+ else {
453
+ return new Execution$1(state, defaultOf());
454
+ }
455
+ break;
456
+ }
457
+ }
458
+
459
+ export function Execution_run(body) {
460
+ let result = undefined;
461
+ let current;
462
+ const execution = body;
463
+ if (Execution$1__get_IsImmediate(execution)) {
464
+ result = some(execution.Value);
465
+ current = Instruction.Finished;
466
+ }
467
+ else {
468
+ current = execution.Resume((value) => {
469
+ result = some(value);
470
+ return Instruction.Finished;
471
+ });
472
+ }
473
+ let handlers = empty();
474
+ while (result == null) {
475
+ try {
476
+ switch (current.tag) {
477
+ case 1: {
478
+ const next = current.fields[0];
479
+ current = next();
480
+ break;
481
+ }
482
+ case 2: {
483
+ const next_1 = current.fields[1];
484
+ const handler = current.fields[0];
485
+ handlers = cons(handler, handlers);
486
+ current = next_1();
487
+ break;
488
+ }
489
+ case 3: {
490
+ const next_2 = current.fields[0];
491
+ handlers = tail_1(handlers);
492
+ current = next_2();
493
+ break;
494
+ }
495
+ default:
496
+ throw new Exception("Execution completed without a result.");
497
+ }
498
+ }
499
+ catch (error) {
500
+ if (isEmpty(handlers)) {
501
+ throw error;
502
+ }
503
+ else {
504
+ const rest = tail_1(handlers);
505
+ const handler_1 = head_1(handlers);
506
+ handlers = rest;
507
+ current = (new Instruction(/* Execute */ 1, [() => handler_1(error)]));
508
+ }
509
+ }
510
+ }
511
+ return value_11(result);
512
+ }
513
+
@@ -434,7 +434,7 @@ export function unwrap(typeName, value) {
434
434
  /**
435
435
  * Validate a call with one set of type-variable bindings, including polymorphic round trips.
436
436
  */
437
- export function validateCall(definitions, signature, arguments$, action) {
437
+ export function prepareCall(definitions, signature, arguments$) {
438
438
  let bindings = empty_2({
439
439
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
440
440
  });
@@ -808,9 +808,14 @@ export function validateCall(definitions, signature, arguments$, action) {
808
808
  }
809
809
  };
810
810
  const resultType_2 = check(signature, arguments$);
811
- const result = action();
812
- observe(resultType_2, result);
813
- return result;
811
+ return (result) => {
812
+ observe(resultType_2, result);
813
+ return result;
814
+ };
815
+ }
816
+
817
+ export function validateCall(definitions, signature, arguments$, action) {
818
+ return prepareCall(definitions, signature, arguments$)(action());
814
819
  }
815
820
 
816
821
  export function invoke(definitions, externalFunction, context, arguments$) {
@@ -4,10 +4,10 @@ import { exists, choose, collect, append, map, ofArray, fold as fold_1, singleto
4
4
  import { fold } from "../fable_modules/fable-library-js.5.13.0/Array.js";
5
5
  import { ParseException, ParseError } from "./Error.js";
6
6
  import { isLetterOrDigit, isLetter } from "../fable_modules/fable-library-js.5.13.0/Char.js";
7
- import { toList as toList_1, fold as fold_2, forAll } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
7
+ import { map as map_1, toList as toList_1, fold as fold_2, forAll } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
8
8
  import { union, toList, ofList, FSharpSet__Contains, empty as empty_1, add } from "../fable_modules/fable-library-js.5.13.0/Set.js";
9
9
  import { curry4, defaultOf, disposeSafe, getEnumerator, Exception, curry2, comparePrimitives } from "../fable_modules/fable-library-js.5.13.0/Util.js";
10
- import { empty as empty_2, add as add_1, FSharpMap__ContainsKey, FSharpMap__get_Item } from "../fable_modules/fable-library-js.5.13.0/Map.js";
10
+ import { ofSeq, empty as empty_2, add as add_1, FSharpMap__ContainsKey, FSharpMap__get_Item } from "../fable_modules/fable-library-js.5.13.0/Map.js";
11
11
  import { TypeDef, Stmt, InterpolatedPart, MapEntry, Param, Expr, Pattern, TypeRef } from "./Ast.js";
12
12
  import { parseProgramWithSourceName } from "./Parser.js";
13
13
  import { FSharpRef } from "../fable_modules/fable-library-js.5.13.0/Types.js";
@@ -813,14 +813,23 @@ function parseProgramFromSourceWithIncludesCore(rootDirectory, entryFile, entryS
813
813
  }, new FSharpRef(curry4(loadFile)), cons(sandboxedPath, stack), isMainFile, sandboxedPath, prefix_2, program);
814
814
  }
815
815
  };
816
- return loadFile(empty(), true, entrySandboxedPath, undefined);
816
+ return [loadFile(empty(), true, entrySandboxedPath, undefined), ofSeq(map_1((pair) => [pair[0], pair[1]], pathPrefixes), {
817
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
818
+ })];
817
819
  }
818
820
 
819
821
  export function parseProgramFromSourceWithIncludes(rootDirectory, entryFile, entrySource) {
820
- return parseProgramFromSourceWithIncludesCore(rootDirectory, entryFile, entrySource, undefined);
822
+ return parseProgramFromSourceWithIncludesCore(rootDirectory, entryFile, entrySource, undefined)[0];
821
823
  }
822
824
 
823
825
  export function parseProgramFromSourceWithIncludesResolver(rootDirectory, entryFile, entrySource, resolveImportedSource) {
826
+ return parseProgramFromSourceWithIncludesCore(rootDirectory, entryFile, entrySource, resolveImportedSource)[0];
827
+ }
828
+
829
+ /**
830
+ * Includes source-module identities for tools which need to display original aliases.
831
+ */
832
+ export function parseProgramFromSourceWithIncludesResolverAndMetadata(rootDirectory, entryFile, entrySource, resolveImportedSource) {
824
833
  return parseProgramFromSourceWithIncludesCore(rootDirectory, entryFile, entrySource, resolveImportedSource);
825
834
  }
826
835
 
@@ -0,0 +1,50 @@
1
+
2
+ import { head, tail, isEmpty, singleton } from "../fable_modules/fable-library-js.5.13.0/List.js";
3
+ import { Scheme as Scheme_1, Type } from "./Types.js";
4
+ import { Exception } from "../fable_modules/fable-library-js.5.13.0/Util.js";
5
+ import { ExternalFunction } from "./Value.js";
6
+
7
+ export const spawn = new ExternalFunction("Task.spawn", new Scheme_1(singleton(0), new Type(/* TFun */ 11, [new Type(/* TFun */ 11, [Type.TUnit, new Type(/* TVar */ 15, [0])]), new Type(/* TTask */ 6, [new Type(/* TVar */ 15, [0])])])), (context, args) => {
8
+ let matchResult, thunk;
9
+ if (!isEmpty(args)) {
10
+ if (isEmpty(tail(args))) {
11
+ matchResult = 0;
12
+ thunk = head(args);
13
+ }
14
+ else {
15
+ matchResult = 1;
16
+ }
17
+ }
18
+ else {
19
+ matchResult = 1;
20
+ }
21
+ switch (matchResult) {
22
+ case 0:
23
+ return context.SpawnTask(thunk);
24
+ default:
25
+ throw new Exception("Task.spawn expects (thunk)");
26
+ }
27
+ }, 1);
28
+
29
+ export const awaitTask = new ExternalFunction("Task.await", new Scheme_1(singleton(0), new Type(/* TFun */ 11, [new Type(/* TTask */ 6, [new Type(/* TVar */ 15, [0])]), new Type(/* TVar */ 15, [0])])), (context, args) => {
30
+ let matchResult, value;
31
+ if (!isEmpty(args)) {
32
+ if (isEmpty(tail(args))) {
33
+ matchResult = 0;
34
+ value = head(args);
35
+ }
36
+ else {
37
+ matchResult = 1;
38
+ }
39
+ }
40
+ else {
41
+ matchResult = 1;
42
+ }
43
+ switch (matchResult) {
44
+ case 0:
45
+ return context.AwaitTask(value);
46
+ default:
47
+ throw new Exception("Task.await expects (task)");
48
+ }
49
+ }, 1);
50
+