@mark1russell7/coeval 0.3.0 → 0.3.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.
- package/build/index.d.ts +49 -12
- package/build/index.d.ts.map +1 -1
- package/build/index.js +26 -10
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/evaluate.ts +67 -11
- package/src/index.ts +1 -0
- package/src/world.ts +8 -3
package/build/index.d.ts
CHANGED
|
@@ -348,10 +348,14 @@ type Alias = {
|
|
|
348
348
|
};
|
|
349
349
|
/** One entry of the world: a kind, a namespace, or an alias. */
|
|
350
350
|
type WorldEntry = Kind | Namespace | Alias;
|
|
351
|
-
/**
|
|
351
|
+
/**
|
|
352
|
+
* A world holds the kinds and the defaults that answer the questions. `fallback` is the kind of each first key that
|
|
353
|
+
* the world does not have. A world with a fallback is open: each path that starts with an unknown key names a kind.
|
|
354
|
+
*/
|
|
352
355
|
interface World {
|
|
353
356
|
readonly kinds: Readonly<Record<string, WorldEntry>>;
|
|
354
357
|
readonly defaults: Readonly<Record<string, string>>;
|
|
358
|
+
readonly fallback?: Kind;
|
|
355
359
|
}
|
|
356
360
|
/** The result of a lookup of a type in the world. */
|
|
357
361
|
type Lookup = {
|
|
@@ -388,7 +392,8 @@ export declare function isNamespace(entry: WorldEntry | undefined): entry is Nam
|
|
|
388
392
|
/**
|
|
389
393
|
* This function finds the kind that a type names. It walks the path from the root of the world, one key at a
|
|
390
394
|
* time. An alias on the way is followed until a kind answers (collapse). A cycle of aliases stops the lookup. In a
|
|
391
|
-
* namespace with a fallback, a key that the namespace does not have gets the fallback kind.
|
|
395
|
+
* namespace with a fallback, a key that the namespace does not have gets the fallback kind. In an open world, a first
|
|
396
|
+
* key that the world does not have gets the fallback kind of the world.
|
|
392
397
|
*
|
|
393
398
|
* @param world - The world.
|
|
394
399
|
* @param type - The reference to the type.
|
|
@@ -904,12 +909,21 @@ interface Runtime {
|
|
|
904
909
|
* This function drives several steps at the same time. When one waits, the others go on.
|
|
905
910
|
*
|
|
906
911
|
* @param list - One function for each item. Each function starts the steps of its item.
|
|
907
|
-
* @param options - The most items that run at the same time
|
|
912
|
+
* @param options - The most items that run at the same time, and the stop at the first failure.
|
|
908
913
|
* @returns The steps that give each result, in the order of the list.
|
|
909
914
|
*/
|
|
910
|
-
all(list: readonly (() => Steps)[], options?:
|
|
911
|
-
|
|
912
|
-
|
|
915
|
+
all(list: readonly (() => Steps)[], options?: AllOptions): Generator<Promise<unknown>, readonly Result[], unknown>;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* The options of a drive of parts at the same time.
|
|
919
|
+
*
|
|
920
|
+
* - `concurrency`: the most parts that run at the same time. The default is each part.
|
|
921
|
+
* - `failFast`: `true` stops at the first part that fails. The parts that did not start do not start, the parts that
|
|
922
|
+
* run stop at their wait, and the results come at once. Each part without a result gives `#ABORT`.
|
|
923
|
+
*/
|
|
924
|
+
interface AllOptions {
|
|
925
|
+
readonly concurrency?: number;
|
|
926
|
+
readonly failFast?: boolean;
|
|
913
927
|
}
|
|
914
928
|
/** Compiled code: the evaluation of a document in a context. */
|
|
915
929
|
type Code = (ctx: Context, rt: Runtime) => Result;
|
|
@@ -944,6 +958,14 @@ interface CompileInput {
|
|
|
944
958
|
/** The keys from the root document to this document. */
|
|
945
959
|
readonly place: readonly Key[];
|
|
946
960
|
readonly machine: Machine;
|
|
961
|
+
/**
|
|
962
|
+
* This function gives the value of the document with an item in the place of each part. The containers on the way
|
|
963
|
+
* to a part are new. The data around the parts stays the same objects.
|
|
964
|
+
*
|
|
965
|
+
* @param items - One item for each part, in the order of `parts`, for example the results of the parts.
|
|
966
|
+
* @returns The value with the items.
|
|
967
|
+
*/
|
|
968
|
+
fill(items: readonly unknown[]): unknown;
|
|
947
969
|
}
|
|
948
970
|
/**
|
|
949
971
|
* A sealed part. An evaluator can read the binding name of a part and evaluate it. It cannot read the value of the
|
|
@@ -998,6 +1020,14 @@ interface EvalInput {
|
|
|
998
1020
|
* @returns The payload, or the error `#CAP!`.
|
|
999
1021
|
*/
|
|
1000
1022
|
effect(kind: Cap, payload: unknown): Result;
|
|
1023
|
+
/**
|
|
1024
|
+
* This function gives the value of the document with an item in the place of each part, for example the result of
|
|
1025
|
+
* each part. The containers on the way to a part are new. The data around the parts stays the same objects.
|
|
1026
|
+
*
|
|
1027
|
+
* @param items - One item for each part, in the order of `parts`.
|
|
1028
|
+
* @returns The value with the items.
|
|
1029
|
+
*/
|
|
1030
|
+
fill(items: readonly unknown[]): unknown;
|
|
1001
1031
|
}
|
|
1002
1032
|
/** A part for a runner. Its evaluation can wait for the effects in it. */
|
|
1003
1033
|
interface RunPart {
|
|
@@ -1037,15 +1067,22 @@ interface RunInput {
|
|
|
1037
1067
|
*/
|
|
1038
1068
|
effect(kind: Cap, payload: unknown): Steps;
|
|
1039
1069
|
/**
|
|
1040
|
-
* This function evaluates parts at the same time. Take the results with `yield*`.
|
|
1070
|
+
* This function evaluates parts at the same time. Take the results with `yield*`. A runner can give its own parts,
|
|
1071
|
+
* for example a part with a different context: each part needs only the function `evaluate`.
|
|
1041
1072
|
*
|
|
1042
1073
|
* @param parts - The parts.
|
|
1043
|
-
* @param options - The most parts that run at the same time.
|
|
1074
|
+
* @param options - The most parts that run at the same time, and the stop at the first failure.
|
|
1044
1075
|
* @returns The steps that give each result, in the order of the parts.
|
|
1045
1076
|
*/
|
|
1046
|
-
all(parts: readonly RunPart[], options?:
|
|
1047
|
-
|
|
1048
|
-
|
|
1077
|
+
all(parts: readonly RunPart[], options?: AllOptions): Generator<Promise<unknown>, readonly Result[], unknown>;
|
|
1078
|
+
/**
|
|
1079
|
+
* This function gives the value of the document with an item in the place of each part, for example the result of
|
|
1080
|
+
* each part. The containers on the way to a part are new. The data around the parts stays the same objects.
|
|
1081
|
+
*
|
|
1082
|
+
* @param items - One item for each part, in the order of `parts`.
|
|
1083
|
+
* @returns The value with the items.
|
|
1084
|
+
*/
|
|
1085
|
+
fill(items: readonly unknown[]): unknown;
|
|
1049
1086
|
}
|
|
1050
1087
|
/** An evaluator that is a function of its input. The kernel calls it for each evaluation. */
|
|
1051
1088
|
type EvalFn = (input: EvalInput) => Result;
|
|
@@ -1600,5 +1637,5 @@ export declare function formulaEvaluators(profile?: FormulaProfile): Readonly<Re
|
|
|
1600
1637
|
*/
|
|
1601
1638
|
export declare function formulaMachine(profile?: FormulaProfile, more?: Partial<Machine>): Machine;
|
|
1602
1639
|
//#endregion
|
|
1603
|
-
export type { Alias, Answer, AskOptions, Cap, CheckOptions, Classification, Closure, Code, CompileInput, CompiledEvaluator, CompiledPart, CompiledRunner, Construct, Context, Part as ContextPart, DerefCode, DocVisit, Edge, Effect, Envelope, ErrorCode, EvalError, EvalFn, EvalInput, EvalOptions, Evaluator, ExtFn, Failed, FormulaProfile, Give, Header, Hop, HopBy, HostThing, Issue, Json, JsonRecord, KernelCode, Key, Kind, KindSource, LazyOp, Lookup, Machine, NamesSource, Namespace, Navigator, NearestOptions, OpFn, OrderProblem, Outcome, Part$1 as Part, PartInfo, Shape as PartShape, PartSlot, PartsSpec, Perform, Plan, PrepareOptions, RefUse, Resolution, ResolveCode, ResolveOptions, Result, Root, Run, RunCode, RunFn, RunInput, RunOptions, RunPart, Rung, Runner, Runtime, ScopeRule, Shape$1 as Shape, Side, Split, Step, StepSpec, Steps, StopSignal, Stored, Thing, TraceNode, TypeRef, Use, WalkInput, WalkOptions, WalkProblem, WalkResult, Walker, World, WorldEntry };
|
|
1640
|
+
export type { Alias, AllOptions, Answer, AskOptions, Cap, CheckOptions, Classification, Closure, Code, CompileInput, CompiledEvaluator, CompiledPart, CompiledRunner, Construct, Context, Part as ContextPart, DerefCode, DocVisit, Edge, Effect, Envelope, ErrorCode, EvalError, EvalFn, EvalInput, EvalOptions, Evaluator, ExtFn, Failed, FormulaProfile, Give, Header, Hop, HopBy, HostThing, Issue, Json, JsonRecord, KernelCode, Key, Kind, KindSource, LazyOp, Lookup, Machine, NamesSource, Namespace, Navigator, NearestOptions, OpFn, OrderProblem, Outcome, Part$1 as Part, PartInfo, Shape as PartShape, PartSlot, PartsSpec, Perform, Plan, PrepareOptions, RefUse, Resolution, ResolveCode, ResolveOptions, Result, Root, Run, RunCode, RunFn, RunInput, RunOptions, RunPart, Rung, Runner, Runtime, ScopeRule, Shape$1 as Shape, Side, Split, Step, StepSpec, Steps, StopSignal, Stored, Thing, TraceNode, TypeRef, Use, WalkInput, WalkOptions, WalkProblem, WalkResult, Walker, World, WorldEntry };
|
|
1604
1641
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Shape","Part"],"sources":["../src/doc.ts","../src/errors.ts","../src/world.ts","../src/ladder.ts","../src/deref.ts","../src/classify.ts","../src/parts.ts","../src/evaluate.ts","../src/stdlib.ts","../src/order.ts","../src/context.ts","../src/static.ts","../src/formula.ts"],"mappings":";;KACY,mDAAmD;YAAmC,cAAA;;;KAGtF;YAAuC,cAAA;;;KAGvC;;;;;;;;;;;KAYA,4BAA4B;WAAmB;WAAsB,gBAAgB;;;;;;KAMrF;;WAED,MAAM;;WAEN,OAAO;;WAEP;;WAEA,MAAM,SAAS;;;qBAIb;;;;;;;;wBASG,SAAS,iBAAiB,SAAS;;;;;;;;wBAanC,MAAM,QAAQ,YAAY,cAAc;;;;;;;wBAUxC,MAAM,iBAAiB,SAAS;;;;;;;;wBAWhC,UAAU,iBAAiB,SAAS;;;;;;;wBAcpC,SAAS,MAAM,mBAAmB;;;;;;;wBAalC,SAAS,MAAM;;;;;;;;;wBAoBf,WAAW,iBAAiB,SAAS,aAAa;;UAOjD;WACN,UAAU;;WAEV,QAAQ,SAAS,eAAe;;;;;;;;;;wBAW3B,OAAO,gBAAgB,4BAA4B;;;;;;;;;wBAqBnD,MAAM,MAAM,SAAS,OAAO,MAAM;WAAmB;WAAwB,MAAM;IAAgC;;;;;;;wBAUnH,OAAO,eAAe,SAAS;;;;;;;wBAU/B,OAAO,KAAK,WAAW;;;;;;;wBAevB,SAAS,iBAAiB;;;;;;;;;;wBAuB1B,UAAU,YAAY;;;;KChO1B;;KAkBA,YAAY;;;;;;;UAQP;WACN,MAAM;WACN;WACA,iBAAiB;WACjB;;;KAIC,OAAO;WAA0B;WAAmB,OAAO;;WAAiB;WAAoB,OAAO;;;KAGvG;WAAoB;WAAoB,OAAO;;;;;;;;wBAQ3C,GAAG,GAAG,OAAO,IAAI,OAAO;;;;;;;;;wBAYxB,KAAK,MAAM,WAAW,gBAAgB;WAAiB,iBAAiB;WAAgB;IAAyB;;;;;;;;;wBAejH,OAAO,GAAG,QAAQ,OAAO,IAAI,gBAAgB,QAAQ,OAAO;;;;;qBAS/D,gBAAgB;WAClB,OAAO;;;;;;EAOhB,YAAY,OAAO;;;;;;;;wBAaL,gBAAgB;;;;;;;;;wBAYhB,OAAO,gBAAgB,cAAc;;;;;;;wBAgBrC,SAAS;;;;KClIb;;;;;;;;;;;;;KAcA;WACG;;WACA;WAAwB;;WACxB;WAAwB;WAAsB,OAAO;;WACrD;WAAuB;WAAsB,OAAO;;WAEpD;WACA,4BAA4B,SAAS,eAAe;WACpD;WACA;WACA,OAAO;;WAEP;WAAwB;;;KAG3B,YAAY;;;;;;;;;;KAWZ;WACG;;WACA,iBAAiB;;WACjB,iBAAiB;;WACjB,iBAAiB;WAAgB;;WACjC;;;;;;UAME;WACN,OAAO;;WAEP,uBAAuB;;WAEvB;;;UAIM;WACN,OAAO,SAAS;;WAEhB,QAAQ;;WAER,iBAAiB;;WAEjB,OAAO;;;;;WAKP;;WAEA;;;UAIM;WACN,OAAO,SAAS,eAAe;WAC/B,WAAW;;;KAIV;WAAmB;WAAsB,gBAAgB;;;KAGzD,aAAa,OAAO,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Shape","Part"],"sources":["../src/doc.ts","../src/errors.ts","../src/world.ts","../src/ladder.ts","../src/deref.ts","../src/classify.ts","../src/parts.ts","../src/evaluate.ts","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,SAAS,SAAS,eAAe;;wBAY9B,SAAS;;;;;;;wBA4BT,gBAAgB,SAAS,eAAe;;;;;;;;wBA6CxC,kBAAkB,UAAS,iBAAsB,SAAS,eAAe;;;;;;;;;wBA4PzE,eAAe,UAAS,gBAAqB,OAAM,QAAQ,WAAgB"}
|
package/build/index.js
CHANGED
|
@@ -352,7 +352,8 @@ function entryAt(entries, key) {
|
|
|
352
352
|
/**
|
|
353
353
|
* This function finds the kind that a type names. It walks the path from the root of the world, one key at a
|
|
354
354
|
* time. An alias on the way is followed until a kind answers (collapse). A cycle of aliases stops the lookup. In a
|
|
355
|
-
* namespace with a fallback, a key that the namespace does not have gets the fallback kind.
|
|
355
|
+
* namespace with a fallback, a key that the namespace does not have gets the fallback kind. In an open world, a first
|
|
356
|
+
* key that the world does not have gets the fallback kind of the world.
|
|
356
357
|
*
|
|
357
358
|
* @param world - The world.
|
|
358
359
|
* @param type - The reference to the type.
|
|
@@ -369,7 +370,7 @@ function lookupKind(world, type) {
|
|
|
369
370
|
let aliases = 0;
|
|
370
371
|
for (;;) {
|
|
371
372
|
let entries = world.kinds;
|
|
372
|
-
let fallback;
|
|
373
|
+
let fallback = world.fallback;
|
|
373
374
|
let entry;
|
|
374
375
|
let followed = false;
|
|
375
376
|
for (let index = 0; index < path.length; index += 1) {
|
|
@@ -1331,18 +1332,24 @@ var Session = class {
|
|
|
1331
1332
|
*all(list, options = {}) {
|
|
1332
1333
|
const results = new Array(list.length);
|
|
1333
1334
|
const limit = Math.max(1, options.concurrency ?? list.length);
|
|
1335
|
+
const failFast = options.failFast === true;
|
|
1336
|
+
let failed = false;
|
|
1334
1337
|
const active = [];
|
|
1335
1338
|
let next = 0;
|
|
1339
|
+
const settle = (index, result) => {
|
|
1340
|
+
results[index] = result;
|
|
1341
|
+
if (failFast && !result.ok) failed = true;
|
|
1342
|
+
};
|
|
1336
1343
|
const advance = (index, steps, input) => {
|
|
1337
1344
|
let step;
|
|
1338
1345
|
try {
|
|
1339
1346
|
step = input.threw ? steps.throw(input.error) : steps.next(input.value);
|
|
1340
1347
|
} catch (error) {
|
|
1341
|
-
|
|
1348
|
+
settle(index, thrown(error, "a part"));
|
|
1342
1349
|
return;
|
|
1343
1350
|
}
|
|
1344
1351
|
if (step.done === true) {
|
|
1345
|
-
|
|
1352
|
+
settle(index, step.value);
|
|
1346
1353
|
return;
|
|
1347
1354
|
}
|
|
1348
1355
|
const item = {
|
|
@@ -1362,7 +1369,7 @@ var Session = class {
|
|
|
1362
1369
|
active.push(item);
|
|
1363
1370
|
};
|
|
1364
1371
|
const start = () => {
|
|
1365
|
-
while (active.length < limit && next < list.length) {
|
|
1372
|
+
while (!failed && active.length < limit && next < list.length) {
|
|
1366
1373
|
const index = next;
|
|
1367
1374
|
next += 1;
|
|
1368
1375
|
const begin = list[index];
|
|
@@ -1370,19 +1377,25 @@ var Session = class {
|
|
|
1370
1377
|
try {
|
|
1371
1378
|
steps = begin();
|
|
1372
1379
|
} catch (error) {
|
|
1373
|
-
|
|
1380
|
+
settle(index, thrown(error, "a part"));
|
|
1374
1381
|
continue;
|
|
1375
1382
|
}
|
|
1376
1383
|
advance(index, steps, { threw: false });
|
|
1377
1384
|
}
|
|
1378
1385
|
};
|
|
1379
1386
|
start();
|
|
1380
|
-
while (active.length > 0) {
|
|
1387
|
+
while (active.length > 0 && !failed) {
|
|
1381
1388
|
const settled = yield Promise.race(active.map((item) => item.pending));
|
|
1382
1389
|
active.splice(active.indexOf(settled.item), 1);
|
|
1383
1390
|
advance(settled.item.index, settled.item.steps, settled);
|
|
1384
1391
|
start();
|
|
1385
1392
|
}
|
|
1393
|
+
if (!failed) return results;
|
|
1394
|
+
const stopped = fail("#ABORT", "The part stopped: a part before it failed, and the parts run with failFast.");
|
|
1395
|
+
for (const item of active) try {
|
|
1396
|
+
item.steps.return(stopped);
|
|
1397
|
+
} catch {}
|
|
1398
|
+
for (let index = 0; index < list.length; index += 1) if (results[index] === void 0) results[index] = stopped;
|
|
1386
1399
|
return results;
|
|
1387
1400
|
}
|
|
1388
1401
|
enter(meta, ctx) {
|
|
@@ -1592,7 +1605,8 @@ function compileNode(c, value, place, declared, depth) {
|
|
|
1592
1605
|
data: split.data,
|
|
1593
1606
|
parts,
|
|
1594
1607
|
place,
|
|
1595
|
-
machine: c.machine
|
|
1608
|
+
machine: c.machine,
|
|
1609
|
+
fill: (items) => split.parts.length === 0 ? doc.value : split.fill(items)
|
|
1596
1610
|
};
|
|
1597
1611
|
const who = `the evaluator ${name}`;
|
|
1598
1612
|
if (runner !== void 0) {
|
|
@@ -1640,7 +1654,8 @@ function interpret(fn, input, fill) {
|
|
|
1640
1654
|
context: ctx,
|
|
1641
1655
|
place,
|
|
1642
1656
|
resolve: (path, options) => rt.resolve(ctx, path, options),
|
|
1643
|
-
effect: (effectKind, payload) => rt.effect(ctx, effectKind, payload, place)
|
|
1657
|
+
effect: (effectKind, payload) => rt.effect(ctx, effectKind, payload, place),
|
|
1658
|
+
fill: input.fill
|
|
1644
1659
|
});
|
|
1645
1660
|
};
|
|
1646
1661
|
}
|
|
@@ -1666,7 +1681,8 @@ function interpretRun(fn, input, fill) {
|
|
|
1666
1681
|
place,
|
|
1667
1682
|
resolve: (path, options) => rt.resolve(ctx, path, options),
|
|
1668
1683
|
effect: (effectKind, payload) => rt.runEffect(ctx, effectKind, payload, place),
|
|
1669
|
-
all: (list, options) => rt.all(list.map((part) => () => part.evaluate()), options)
|
|
1684
|
+
all: (list, options) => rt.all(list.map((part) => () => part.evaluate()), options),
|
|
1685
|
+
fill: input.fill
|
|
1670
1686
|
});
|
|
1671
1687
|
};
|
|
1672
1688
|
}
|