@mark1russell7/coeval 0.17.0 → 0.19.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 +4 -4
- package/build/index.d.ts +302 -98
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3555 -2068
- package/build/index.js.map +1 -1
- package/package.json +3 -2
- package/src/codec.ts +30 -10
- package/src/conform.ts +35 -9
- package/src/durable.ts +17 -5
- package/src/evaluate.ts +38 -2
- package/src/facts.ts +55 -19
- package/src/formula.ts +59 -4
- package/src/index.ts +16 -2
- package/src/instances.ts +637 -0
- package/src/merge.ts +6 -3
- package/src/reads.ts +186 -2
- package/src/reference.ts +20 -1
- package/src/replay.ts +123 -35
- package/src/static.ts +357 -50
- package/src/stdlib.ts +127 -6
- package/src/types.ts +103 -23
- package/src/typing.ts +143 -3
- package/src/world.ts +49 -0
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/doc.d.ts
|
|
2
1
|
/** A JSON value. A document is JSON. */
|
|
3
2
|
type Json = null | boolean | number | string | readonly Json[] | {
|
|
4
3
|
readonly [key: string]: Json;
|
|
@@ -159,8 +158,6 @@ export declare function fromJson(value: unknown): Envelope | undefined;
|
|
|
159
158
|
* @returns `true` when the values are equal.
|
|
160
159
|
*/
|
|
161
160
|
export declare function docEquals(a: unknown, b: unknown): boolean;
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/errors.d.ts
|
|
164
161
|
/** The codes that the kernel gives. */
|
|
165
162
|
type KernelCode = "#KIND?" | "#NOEVAL" | "#PART?" | "#NAME?" | "#REF!" | "#N/A" | "#CYCLE!" | "#STEP?" | "#VALUE!" | "#NUM!" | "#ARGS" | "#CAP!" | "#CALC!" | "#DEPTH!" | "#ABORT" | "#REPLAY!" | "#TYPE!";
|
|
166
163
|
/** The code of an error value. A language can add its own codes. Each code starts with `#`. */
|
|
@@ -254,8 +251,6 @@ export declare function thrown(error: unknown, who: string): Failed;
|
|
|
254
251
|
* @returns The text.
|
|
255
252
|
*/
|
|
256
253
|
export declare function describe(value: unknown): string;
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region src/deref.d.ts
|
|
259
254
|
/**
|
|
260
255
|
* The brand of a host thing: an object of the host that answers the steps of a path itself. The brand is a
|
|
261
256
|
* global symbol, thus two copies of the kernel in one program know the things of each other.
|
|
@@ -537,8 +532,6 @@ export declare function resolve(nav: Navigator, ctx: Context, path: readonly unk
|
|
|
537
532
|
* @returns The value.
|
|
538
533
|
*/
|
|
539
534
|
export declare function valueOfThing(thing: Thing): unknown;
|
|
540
|
-
//#endregion
|
|
541
|
-
//#region src/types.d.ts
|
|
542
535
|
/**
|
|
543
536
|
* A value type: a set of values that a result can have, as a JSON term.
|
|
544
537
|
*
|
|
@@ -605,6 +598,12 @@ interface Domain {
|
|
|
605
598
|
* domain does not count. The check reads a list of at most 64 values.
|
|
606
599
|
*/
|
|
607
600
|
readonly values?: readonly unknown[];
|
|
601
|
+
/**
|
|
602
|
+
* Some members of the domain for the tests of `conforms`, for example `0` and `-1` of `number` (D99). The checks
|
|
603
|
+
* `truth` and `cover` add the samples of each domain to the palette. A sample that fails a test of a type does not
|
|
604
|
+
* count. The list is not a full list of the members, thus `fits` does not read it.
|
|
605
|
+
*/
|
|
606
|
+
readonly samples?: readonly unknown[];
|
|
608
607
|
/**
|
|
609
608
|
* The covers of the domain (TYPE.FITS-COVER, D85). A cover is a list of domains under this domain, and its domains
|
|
610
609
|
* together hold each member of this domain. An example is a domain of negative numbers and a domain of the other
|
|
@@ -612,7 +611,7 @@ interface Domain {
|
|
|
612
611
|
*
|
|
613
612
|
* A split of a record also narrows a field of the domain to each domain of a cover (D90).
|
|
614
613
|
* The language keeps each cover true, and `fits` trusts it, as it trusts `values`. A cover that is empty, or that
|
|
615
|
-
* names this domain or a name that is not under it, does not count.
|
|
614
|
+
* names this domain or a name that is not under it, does not count. `conforms` tests each cover from samples (D94).
|
|
616
615
|
*/
|
|
617
616
|
readonly covers?: readonly (readonly string[])[];
|
|
618
617
|
}
|
|
@@ -694,16 +693,18 @@ export declare function member(value: unknown, type: ValueType, domains?: Readon
|
|
|
694
693
|
* split first, then the paths of each next depth, in the order of the keys. A path goes into a record without a
|
|
695
694
|
* finite list. Thus `{a: {x: bool}}` fits the union of `{a: {x: true}}` and `{a: {x: false}}`.
|
|
696
695
|
* - A type split comes after each value split (TYPE.FITS-SPLIT-TYPE, D90). A field of a base type with a valid cover in
|
|
697
|
-
* its line splits into the domains of
|
|
698
|
-
* members. A case that does not fit splits again at its path, by the same rules. A base type there uses only
|
|
699
|
-
*
|
|
696
|
+
* its line splits into the domains of a cover. A field of a union without a finite list splits into its
|
|
697
|
+
* members. A case that does not fit splits again at its path, by the same rules. A base type there uses only the
|
|
698
|
+
* covers of its own domain. Thus `{a: number}` fits `{a: neg} | {a: nonneg}` when `neg` and `nonneg` cover `number`.
|
|
699
|
+
* - A field with more than one valid cover tries each cover until one fits (TYPE.FITS-SPLIT-COVERS, D102). The order
|
|
700
|
+
* is the order of the line, then the order of the covers of each domain.
|
|
700
701
|
*
|
|
701
702
|
* The relation is sound: a member of `found` is a member of `expected` when no `unknown` is in the types
|
|
702
703
|
* (TYPE.FITS-SOUND). The finite rule trusts `values`, and the cover rule trusts `covers`. Thus a list without a member
|
|
703
704
|
* or a false cover makes the relation unsound for that domain.
|
|
704
705
|
*
|
|
705
|
-
* The relation is not complete. A split builds at most 64 records, with each split inside its work at each depth.
|
|
706
|
-
*
|
|
706
|
+
* The relation is not complete. A split builds at most 64 records, with each split inside its work at each depth. The
|
|
707
|
+
* failed tries of covers take from these 64 records too. A domain without `values` gets no finite rule, and
|
|
707
708
|
* neither does a type with more than 64 members that is not a record. The cover rule tests at most 64 domains of
|
|
708
709
|
* covers. The function does not throw.
|
|
709
710
|
*
|
|
@@ -760,8 +761,6 @@ export declare function typeText(type: ValueType): string;
|
|
|
760
761
|
* @returns The problems. A term comes before its parts, and the parts keep their order.
|
|
761
762
|
*/
|
|
762
763
|
export declare function typeIssues(type: unknown, domains?: Readonly<Record<string, Domain>>): readonly TypeIssue[];
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region src/world.d.ts
|
|
765
764
|
/** The two sides of evaluation. `derive` is pure. `run` causes effects in order. */
|
|
766
765
|
type Side = "derive" | "run";
|
|
767
766
|
/**
|
|
@@ -1125,8 +1124,6 @@ export declare function kindDocument(name: string, kind: Kind): Envelope;
|
|
|
1125
1124
|
* @returns `true` when the value has verbs.
|
|
1126
1125
|
*/
|
|
1127
1126
|
export declare function looksLikeKind(value: unknown): boolean;
|
|
1128
|
-
//#endregion
|
|
1129
|
-
//#region src/ladder.d.ts
|
|
1130
1127
|
/** The rungs of the ladder, in the order that a question visits them. */
|
|
1131
1128
|
export declare const RUNGS: readonly ["own", "kind", "default"];
|
|
1132
1129
|
/** One rung of the ladder. */
|
|
@@ -1209,8 +1206,6 @@ export declare function kindNamed(world: World, name: TypeRef): Kind | undefined
|
|
|
1209
1206
|
* @returns The answer, with the record of each rung that the question visited.
|
|
1210
1207
|
*/
|
|
1211
1208
|
export declare function ask(world: World, doc: Header, verb: string, options?: AskOptions): Answer;
|
|
1212
|
-
//#endregion
|
|
1213
|
-
//#region src/static.d.ts
|
|
1214
1209
|
/** One document that a walk visits. */
|
|
1215
1210
|
interface DocVisit {
|
|
1216
1211
|
/** The keys from the root document to this document, through the parts. It is the place of an error. */
|
|
@@ -1435,34 +1430,63 @@ export declare function typeCheck(machine: Machine, doc: unknown, options?: Chec
|
|
|
1435
1430
|
/**
|
|
1436
1431
|
* A problem of a world that `checkWorld` finds before a document exists (STATIC.COVERAGE). Each document of the
|
|
1437
1432
|
* kind gives this problem for the verb, thus `check` with the verb finds it too.
|
|
1433
|
+
*
|
|
1434
|
+
* With the option `types`, a problem can also be a bad value type of the machine (TYPE.WORLD, D110). Such a problem has
|
|
1435
|
+
* the code `#TYPE!` and the keys of the bad term in `at`.
|
|
1438
1436
|
*/
|
|
1439
1437
|
interface WorldIssue {
|
|
1440
|
-
/**
|
|
1441
|
-
|
|
1442
|
-
|
|
1438
|
+
/**
|
|
1439
|
+
* The code of the problem. `#NOEVAL`: no rung of the ladder gives an evaluator for the verb. `#TYPE!`: a value type
|
|
1440
|
+
* of the machine is not correct, or a declaration of types cannot be true.
|
|
1441
|
+
*/
|
|
1442
|
+
readonly code: "#NOEVAL" | "#TYPE!";
|
|
1443
|
+
/**
|
|
1444
|
+
* The keys of the kind from the root of the world. For a fallback kind, the keys of its namespace. For a type of a
|
|
1445
|
+
* domain or of a type rule, the list is empty.
|
|
1446
|
+
*/
|
|
1443
1447
|
readonly kind: readonly Key[];
|
|
1444
1448
|
/** `true` for the fallback kind of a namespace or of the world. */
|
|
1445
1449
|
readonly fallback?: true;
|
|
1446
|
-
/** The verb without an evaluator. */
|
|
1450
|
+
/** The verb without an evaluator. A type issue has the verb `eval`, because the value types describe `eval` (D25). */
|
|
1447
1451
|
readonly verb: string;
|
|
1452
|
+
/** For a type issue of a domain: the name of the domain in `Machine.domains`. */
|
|
1453
|
+
readonly domain?: string;
|
|
1454
|
+
/** For a type issue of a type rule: the name of its evaluator in `Machine.evaluators`. */
|
|
1455
|
+
readonly evaluator?: string;
|
|
1456
|
+
/**
|
|
1457
|
+
* For a type issue: the keys of the bad term in the kind, the domain or the declarations of the rule. An example is
|
|
1458
|
+
* `["parts", "item", "expect"]`, or `["sigs", "add", 1, "params", 0]`.
|
|
1459
|
+
*/
|
|
1460
|
+
readonly at?: readonly Key[];
|
|
1448
1461
|
readonly reason: string;
|
|
1449
1462
|
}
|
|
1463
|
+
/** The options of `checkWorld`. */
|
|
1464
|
+
interface WorldOptions {
|
|
1465
|
+
/**
|
|
1466
|
+
* With `true`, the check also examines each value type of the machine (TYPE.WORLD, D110). It reads the contracts of
|
|
1467
|
+
* the kinds, the domains and the declarations of the type rules. The default is `false`.
|
|
1468
|
+
*/
|
|
1469
|
+
readonly types?: boolean;
|
|
1470
|
+
}
|
|
1450
1471
|
/**
|
|
1451
1472
|
* This function checks the world of a machine before a document exists. It finds each kind that has no entry for a
|
|
1452
1473
|
* verb of the list, when the world has no default for that verb (STATIC.COVERAGE). A document of such a kind gets no
|
|
1453
1474
|
* evaluator for the verb, thus the check gives the same proof of coverage as a type system.
|
|
1454
1475
|
*
|
|
1455
1476
|
* The check visits each kind of each namespace, at each depth, and the fallback kind of each namespace and of the
|
|
1456
|
-
* world. It does not follow an alias, because the kind of an alias has its own place.
|
|
1477
|
+
* world. It does not follow an alias, because the kind of an alias has its own place. Without the option `types`, the
|
|
1478
|
+
* check reads only the world.
|
|
1479
|
+
*
|
|
1480
|
+
* With the option `types`, the check also examines each value type of the machine (TYPE.WORLD, D110). These issues
|
|
1481
|
+
* have the code `#TYPE!`, and they come after the issues of the verbs.
|
|
1457
1482
|
*
|
|
1458
1483
|
* @param machine - The machine, for its world.
|
|
1459
1484
|
* @param verbs - The verbs that each kind of the language must answer, for example `eval`, `view` and `type`.
|
|
1485
|
+
* @param options - The option `types`.
|
|
1460
1486
|
* @returns One issue for each kind and verb without an evaluator. The order is the order of the world, then the
|
|
1461
1487
|
* order of the verbs. The fallback kind of a namespace comes after the entries of that namespace.
|
|
1462
1488
|
*/
|
|
1463
|
-
export declare function checkWorld(machine: Machine, verbs: readonly string[]): readonly WorldIssue[];
|
|
1464
|
-
//#endregion
|
|
1465
|
-
//#region src/typing.d.ts
|
|
1489
|
+
export declare function checkWorld(machine: Machine, verbs: readonly string[], options?: WorldOptions): readonly WorldIssue[];
|
|
1466
1490
|
/** What a type rule gets for one document. */
|
|
1467
1491
|
interface TypeInput {
|
|
1468
1492
|
/** The keys of the kind of the document, after each alias. */
|
|
@@ -1582,7 +1606,32 @@ interface TypeRule {
|
|
|
1582
1606
|
* @returns The type of the document.
|
|
1583
1607
|
*/
|
|
1584
1608
|
readonly synth: (input: TypeInput, report: (problem: TypeProblem) => void) => ValueType;
|
|
1609
|
+
/**
|
|
1610
|
+
* This function lists the declarations that the rule reads, for example the signatures of a formula profile
|
|
1611
|
+
* (TYPE.WORLD, D110). `checkWorld` with the option `types` examines each one before a document exists. A rule
|
|
1612
|
+
* without this function declares nothing.
|
|
1613
|
+
*
|
|
1614
|
+
* @returns The value types that the rule reads, and the problems that the rule finds in its declarations.
|
|
1615
|
+
*/
|
|
1616
|
+
readonly declared?: () => readonly Declared[];
|
|
1585
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* One declaration of a type rule (TYPE.WORLD, D110). It is a value type that the rule reads, with what it is. Or it is
|
|
1620
|
+
* a problem that the rule finds in a declaration, for example an overload that the check does not select at any time.
|
|
1621
|
+
*/
|
|
1622
|
+
type Declared = {
|
|
1623
|
+
/** The keys of the declaration in the declarations of the rule, for example `["sigs", "add", "to"]`. */
|
|
1624
|
+
readonly at: readonly Key[];
|
|
1625
|
+
/** The value type. `checkWorld` examines it with `typeIssues`. */
|
|
1626
|
+
readonly type: unknown;
|
|
1627
|
+
/** What the type is, for the reason of an issue, for example "result of a signature of ops.add". */
|
|
1628
|
+
readonly what: string;
|
|
1629
|
+
} | {
|
|
1630
|
+
/** The keys of the declaration in the declarations of the rule. */
|
|
1631
|
+
readonly at: readonly Key[];
|
|
1632
|
+
/** The reason of the problem. */
|
|
1633
|
+
readonly problem: string;
|
|
1634
|
+
};
|
|
1586
1635
|
/** The type of one document of a check of types. */
|
|
1587
1636
|
interface Typed {
|
|
1588
1637
|
/** The keys from the root document to the document. */
|
|
@@ -1594,8 +1643,6 @@ interface Typed {
|
|
|
1594
1643
|
/** The type that the position of the document needs, when it needs one. */
|
|
1595
1644
|
readonly expected?: ValueType;
|
|
1596
1645
|
}
|
|
1597
|
-
//#endregion
|
|
1598
|
-
//#region src/facts.d.ts
|
|
1599
1646
|
/**
|
|
1600
1647
|
* One read of a document: a free reference, with its marks (FACTS.READS). A plan resolves the path of the reference
|
|
1601
1648
|
* when it evaluates the reference. The static read covers each path that the plan resolves there (FACTS.SOUND). A
|
|
@@ -1632,9 +1679,12 @@ interface DocFacts {
|
|
|
1632
1679
|
* here. The roots that a kind declares in `reads` are here too, each one at the place of its document.
|
|
1633
1680
|
*/
|
|
1634
1681
|
readonly reads: readonly StaticRead[];
|
|
1635
|
-
/** `"run"` when one kind of the document is on the run side (FACTS.SIDE). */
|
|
1682
|
+
/** `"run"` when one kind of the document is on the run side for the verb of the facts (FACTS.SIDE, FACTS.VERB-SIDE). */
|
|
1636
1683
|
readonly side: Side;
|
|
1637
|
-
/**
|
|
1684
|
+
/**
|
|
1685
|
+
* The kinds of the effects that the contracts declare for the verb of the facts, as texts with dots, each one time
|
|
1686
|
+
* (FACTS.EFFECTS, FACTS.VERB-EFFECTS).
|
|
1687
|
+
*/
|
|
1638
1688
|
readonly effects: readonly string[];
|
|
1639
1689
|
/**
|
|
1640
1690
|
* `true` when each kind of the document declares `pure`, and the document has no effect and is not volatile. Then
|
|
@@ -1651,8 +1701,10 @@ interface FactsOptions {
|
|
|
1651
1701
|
/** The type of a bare root value. */
|
|
1652
1702
|
readonly declaredType?: string;
|
|
1653
1703
|
/**
|
|
1654
|
-
* The verb whose evaluators the facts describe, as in `prepare`. The default is `eval`. The
|
|
1655
|
-
*
|
|
1704
|
+
* The verb whose evaluators the facts describe, as in `prepare`. The default is `eval`. The marks `pure`,
|
|
1705
|
+
* `volatile` and `lazy` of a contract describe the code of `eval` only. For another verb, only the hook `facts`
|
|
1706
|
+
* describes the code (FACTS.VERB). The side and the effects come from the entry of the verb in `verbEffects`
|
|
1707
|
+
* (FACTS.VERB-EFFECTS, D111).
|
|
1656
1708
|
*/
|
|
1657
1709
|
readonly verb?: string;
|
|
1658
1710
|
/**
|
|
@@ -1673,7 +1725,7 @@ interface FactsOptions {
|
|
|
1673
1725
|
* declares `reads` adds a read of each of its roots at each document of the kind. The first document of a tree
|
|
1674
1726
|
* kind also gets the lazy reads of the equations of its kind (FACTS.EQUATIONS). A read from `self` or from a name
|
|
1675
1727
|
* of a rung is not one of them, because it is not free (READS.EQUATION).
|
|
1676
|
-
* - `side` and `effects`: from the contract of each kind.
|
|
1728
|
+
* - `side` and `effects`: from the contract of each kind, for the verb of the facts.
|
|
1677
1729
|
* - `pure`: each kind declares `pure`, also in an equation, and the document has no effect and is not volatile.
|
|
1678
1730
|
* - `volatile`: a kind, an operation or a step document declares `volatile`, or the host marks a read.
|
|
1679
1731
|
*
|
|
@@ -1682,9 +1734,11 @@ interface FactsOptions {
|
|
|
1682
1734
|
* entry. Thus a document with an own entry for another evaluator is not pure, and each of its parts is lazy. The
|
|
1683
1735
|
* hook can still answer for that evaluator.
|
|
1684
1736
|
*
|
|
1685
|
-
* The option `verb` names the verb whose code the facts describe (FACTS.VERB).
|
|
1686
|
-
* `eval`, thus the rule of an own entry applies to each document for another verb.
|
|
1687
|
-
*
|
|
1737
|
+
* The option `verb` names the verb whose code the facts describe (FACTS.VERB). The marks of a contract describe the
|
|
1738
|
+
* code of `eval`, thus the rule of an own entry applies to each document for another verb. For another verb, the
|
|
1739
|
+
* effects are the effects that the entry of the verb in `verbEffects` declares (FACTS.VERB-EFFECTS, D111). A kind is
|
|
1740
|
+
* on the run side for that verb when its entry declares an effect (FACTS.VERB-SIDE). A kind without an entry for the
|
|
1741
|
+
* verb adds no effect, as in `check` (FACTS.VERB-UNDECLARED). Its code is still not pure without an answer of the hook.
|
|
1688
1742
|
*
|
|
1689
1743
|
* A read is one resolution of its path. A reference that the resolution reaches and follows is a part of that read
|
|
1690
1744
|
* (DEREF.COLLAPSE), not a separate read. The facts depend only on the document and the machine. Thus a host computes
|
|
@@ -1696,8 +1750,6 @@ interface FactsOptions {
|
|
|
1696
1750
|
* @returns The facts.
|
|
1697
1751
|
*/
|
|
1698
1752
|
export declare function factsOf(machine: Machine, doc: unknown, options?: FactsOptions): DocFacts;
|
|
1699
|
-
//#endregion
|
|
1700
|
-
//#region src/evaluate.d.ts
|
|
1701
1753
|
/**
|
|
1702
1754
|
* This function makes a context with names and capabilities. The other roots are empty, and an evaluation sets
|
|
1703
1755
|
* the world.
|
|
@@ -2391,8 +2443,6 @@ export declare function flatten(trace: TraceNode): readonly TraceNode[];
|
|
|
2391
2443
|
* @returns The errors, in the order of their start.
|
|
2392
2444
|
*/
|
|
2393
2445
|
export declare function failures(trace: TraceNode): readonly EvalError[];
|
|
2394
|
-
//#endregion
|
|
2395
|
-
//#region src/merge.d.ts
|
|
2396
2446
|
/** The keys from a part of a merge to one of its entries, for example `["kinds", "ref"]`. */
|
|
2397
2447
|
type MergePath = readonly Key[];
|
|
2398
2448
|
/**
|
|
@@ -2447,8 +2497,8 @@ interface DomainExtension {
|
|
|
2447
2497
|
/**
|
|
2448
2498
|
* This function makes a part of a merge that adds parents, steps or covers to a domain of an earlier part
|
|
2449
2499
|
* (TYPE.PARENTS). An example is a domain of another language. The part reads the domain from the merge before it
|
|
2450
|
-
* (`prev`). It gives a copy with the same test, summary, codec
|
|
2451
|
-
* in `replaces` (D17).
|
|
2500
|
+
* (`prev`). It gives a copy with the same test, summary, codec, list of values and samples, and it names
|
|
2501
|
+
* `["domains", name]` in `replaces` (D17).
|
|
2452
2502
|
* A domain of the kernel that the earlier parts do not name comes from `STD_DOMAINS`.
|
|
2453
2503
|
*
|
|
2454
2504
|
* An extension does not change the codec. Thus each member keeps its document (D80).
|
|
@@ -2531,8 +2581,6 @@ export declare function restrictWorld(world: World, paths: readonly MergePath[])
|
|
|
2531
2581
|
* @returns The machine without the entries.
|
|
2532
2582
|
*/
|
|
2533
2583
|
export declare function restrictMachine(machine: Machine, paths: readonly MergePath[]): Machine;
|
|
2534
|
-
//#endregion
|
|
2535
|
-
//#region src/classify.d.ts
|
|
2536
2584
|
/** A shape proposes a kind for each document that has all of its fields. */
|
|
2537
2585
|
interface Shape$1 {
|
|
2538
2586
|
readonly name: string;
|
|
@@ -2567,8 +2615,6 @@ export declare function classify(shapes: readonly Shape$1[], value: Json): Class
|
|
|
2567
2615
|
* @returns The envelope.
|
|
2568
2616
|
*/
|
|
2569
2617
|
export declare function tag(value: Json, kind: string): Envelope;
|
|
2570
|
-
//#endregion
|
|
2571
|
-
//#region src/parts.d.ts
|
|
2572
2618
|
/** One part of a value: its place in the value, the JSON of the part, and the type that its position declares. */
|
|
2573
2619
|
interface PartSlot {
|
|
2574
2620
|
/** The keys from the value of the document to the part. */
|
|
@@ -2655,8 +2701,6 @@ export declare function partsOf(world: World, value: unknown, declaredType?: str
|
|
|
2655
2701
|
* @returns `true` when the path matches.
|
|
2656
2702
|
*/
|
|
2657
2703
|
export declare function pathMatches(path: readonly Key[], pattern: readonly Key[]): boolean;
|
|
2658
|
-
//#endregion
|
|
2659
|
-
//#region src/syntax.d.ts
|
|
2660
2704
|
/** The place of an operator: before its term, between two terms, or after its term. */
|
|
2661
2705
|
type SyntaxFixity = "prefix" | "infix" | "postfix";
|
|
2662
2706
|
/**
|
|
@@ -2851,8 +2895,6 @@ export declare function print(profile: SyntaxProfile, doc: unknown): Result<stri
|
|
|
2851
2895
|
* @returns The part for `mergeMachines`.
|
|
2852
2896
|
*/
|
|
2853
2897
|
export declare function syntaxFormat(profile: SyntaxProfile): MachinePart;
|
|
2854
|
-
//#endregion
|
|
2855
|
-
//#region src/stdlib.d.ts
|
|
2856
2898
|
/**
|
|
2857
2899
|
* The world of the examples: small kinds for numbers, lists, conditions, names, sequences and effects.
|
|
2858
2900
|
* Each kind names an evaluator for `eval` and a view for `view`. The site draws each document with its view.
|
|
@@ -2886,6 +2928,50 @@ interface AttributeTrace {
|
|
|
2886
2928
|
/** The rung that answered. It is `undefined` when no rung answered. */
|
|
2887
2929
|
readonly by?: AttributeRung;
|
|
2888
2930
|
}
|
|
2931
|
+
/** The answer of the ladder for one attribute of one node (TREE.CELL, D108). */
|
|
2932
|
+
interface AttributeAnswer {
|
|
2933
|
+
/** The result of the attribute. It is `undefined` when no rung answered. */
|
|
2934
|
+
readonly result: Result | undefined;
|
|
2935
|
+
/** The rung that answered. It is `undefined` when no rung answered. */
|
|
2936
|
+
readonly by: AttributeRung | undefined;
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* This function gives the memo cell of one attribute of one node, for a host that keeps its cells between evaluations
|
|
2940
|
+
* (TREE.CELL, D108). The kit uses it at each demand of an attribute in an evaluation.
|
|
2941
|
+
*
|
|
2942
|
+
* The array `place` is one object for each document of a plan, and it stays the same across the evaluations of that
|
|
2943
|
+
* plan. A new plan gives new arrays. Thus a host keeps its cells by the identity of `place` and by `attribute`.
|
|
2944
|
+
* A host that keeps its cells by the keys of `place` can give a stale answer after a change of the document.
|
|
2945
|
+
*
|
|
2946
|
+
* The function gives the answer of `compute`, or a kept answer. A host with signals gives a computed signal: a change
|
|
2947
|
+
* of its store then makes only the attributes that read the store compute again. Each demand gives a new `compute`, and
|
|
2948
|
+
* a cell that computes again uses the last one.
|
|
2949
|
+
*
|
|
2950
|
+
* The kit marks an attribute in evaluation before it uses the cell. Thus a cycle gives `#CYCLE!` before it reaches the
|
|
2951
|
+
* cell again. An exception of the function that `compute` did not throw gives `#CYCLE!` with the chain of the demands.
|
|
2952
|
+
*
|
|
2953
|
+
* @param place - The keys from the root document to the document of the node.
|
|
2954
|
+
* @param attribute - The name of the attribute.
|
|
2955
|
+
* @param compute - The function that visits the rungs of the ladder.
|
|
2956
|
+
* @returns The answer.
|
|
2957
|
+
*/
|
|
2958
|
+
type AttributeCell = (place: readonly Key[], attribute: string, compute: () => AttributeAnswer) => AttributeAnswer;
|
|
2959
|
+
/** The options of the tree kit (D108). */
|
|
2960
|
+
interface TreeOptions {
|
|
2961
|
+
/**
|
|
2962
|
+
* The memo cells of the host (TREE.CELL). The default is a plain memo for each node and attribute, for one
|
|
2963
|
+
* evaluation (TREE.MEMO).
|
|
2964
|
+
*/
|
|
2965
|
+
readonly cell?: AttributeCell;
|
|
2966
|
+
}
|
|
2967
|
+
/**
|
|
2968
|
+
* This function gives the code of the kind of a node of the decorated tree, with the options of the host. A host puts
|
|
2969
|
+
* the code at the name `tree.node` of its machine. Without a cell, the code is the standard code.
|
|
2970
|
+
*
|
|
2971
|
+
* @param options - The options, for example the memo cells of the host.
|
|
2972
|
+
* @returns The code.
|
|
2973
|
+
*/
|
|
2974
|
+
export declare function treeNodeEvaluator(options?: TreeOptions): Evaluator;
|
|
2889
2975
|
/**
|
|
2890
2976
|
* This function gives the record of the demand of an attribute of a node of the decorated tree (TREE.RUNGS). The
|
|
2891
2977
|
* record holds the rungs that the demand visited, and the rung that answered. An explorer draws the ladder with it.
|
|
@@ -2942,8 +3028,6 @@ export declare const STD_RUNNERS: Readonly<Record<string, Runner>>;
|
|
|
2942
3028
|
export declare const STD_MACHINE: Machine;
|
|
2943
3029
|
/** The capabilities of the examples at the root: the two effects of the standard world. */
|
|
2944
3030
|
export declare const STD_CAPS: readonly string[];
|
|
2945
|
-
//#endregion
|
|
2946
|
-
//#region src/order.d.ts
|
|
2947
3031
|
/** One step of a sequence: its name, the names of the earlier steps that it reads, and if it has an effect. */
|
|
2948
3032
|
interface StepSpec {
|
|
2949
3033
|
readonly id: string;
|
|
@@ -2998,8 +3082,6 @@ export declare function isAllowedOrder(steps: readonly StepSpec[], order: readon
|
|
|
2998
3082
|
* @returns The layers, first to last. Each layer keeps the written order.
|
|
2999
3083
|
*/
|
|
3000
3084
|
export declare function layers(steps: readonly StepSpec[]): readonly (readonly string[])[];
|
|
3001
|
-
//#endregion
|
|
3002
|
-
//#region src/context.d.ts
|
|
3003
3085
|
/** The parts of a context. A term can reach outside itself only through these parts. */
|
|
3004
3086
|
export declare const PARTS: readonly ["self", "names", "world", "event", "caps"];
|
|
3005
3087
|
/** One part of a context. */
|
|
@@ -3043,8 +3125,6 @@ interface Construct {
|
|
|
3043
3125
|
}
|
|
3044
3126
|
/** Six constructs that show the range of the context. */
|
|
3045
3127
|
export declare const CONSTRUCTS: readonly Construct[];
|
|
3046
|
-
//#endregion
|
|
3047
|
-
//#region src/effects.d.ts
|
|
3048
3128
|
/** The options of `effectsOf`. */
|
|
3049
3129
|
interface EffectsOptions {
|
|
3050
3130
|
/** The type of a bare root value. */
|
|
@@ -3090,8 +3170,6 @@ export declare function effectsOf(machine: Machine, doc: unknown, options?: Effe
|
|
|
3090
3170
|
* @returns The issues, in the order of the body.
|
|
3091
3171
|
*/
|
|
3092
3172
|
export declare function checkLatent(machine: Machine, declared: readonly Cap[], body: unknown, options?: Omit<EffectsOptions, "caps">): readonly Issue[];
|
|
3093
|
-
//#endregion
|
|
3094
|
-
//#region src/formula.d.ts
|
|
3095
3173
|
/** An operation of a formula language: a function of the values of its arguments. */
|
|
3096
3174
|
type OpFn = (...args: never[]) => unknown;
|
|
3097
3175
|
/**
|
|
@@ -3111,6 +3189,8 @@ type ExtFn = (data: Json, context: Context, domains?: Readonly<Record<string, Do
|
|
|
3111
3189
|
* - `lazy`: the operations that evaluate their arguments themselves.
|
|
3112
3190
|
* - `ext`: the extensions of the namespace `ext`, by their name. The kit has `ext.undefined`, `ext.number` and
|
|
3113
3191
|
* `ext.domain`.
|
|
3192
|
+
* - `extTypes`: the value type of each extension of `ext`, by its name, for a check of types (TYPE.EXT, D103). An
|
|
3193
|
+
* extension without an entry gives `unknown` (TYPE.GRADUAL). An entry for a standard extension has no effect.
|
|
3114
3194
|
* - `truthy`: the truth of a value for `if`, `and` and `or`. `undefined` is an error `#VALUE!`. The default
|
|
3115
3195
|
* accepts only `true` and `false`.
|
|
3116
3196
|
* - `truthType`: the value type of a truth for the own `truthy`, for a check of types (TYPE.TRUTH, D81). A test of
|
|
@@ -3134,12 +3214,13 @@ type ExtFn = (data: Json, context: Context, domains?: Readonly<Record<string, Do
|
|
|
3134
3214
|
*
|
|
3135
3215
|
* A check of types trusts the signatures. Each operation must give a member of the result of each signature that
|
|
3136
3216
|
* its arguments match. The hook `check` must keep each result in that type. The function `truthy` must give a truth
|
|
3137
|
-
* for each member of `truthType`.
|
|
3217
|
+
* for each member of `truthType`. Each extension must give a member of its type in `extTypes`.
|
|
3138
3218
|
*/
|
|
3139
3219
|
interface FormulaProfile {
|
|
3140
3220
|
readonly ops?: Readonly<Record<string, OpFn>> | ((name: string) => OpFn | undefined);
|
|
3141
3221
|
readonly lazy?: Readonly<Record<string, LazyOp>>;
|
|
3142
3222
|
readonly ext?: Readonly<Record<string, ExtFn>>;
|
|
3223
|
+
readonly extTypes?: Readonly<Record<string, ValueType>>;
|
|
3143
3224
|
readonly truthy?: (value: unknown) => boolean | undefined;
|
|
3144
3225
|
readonly truthType?: ValueType;
|
|
3145
3226
|
readonly otherwise?: unknown;
|
|
@@ -3261,8 +3342,6 @@ export declare function formulaFacts(profile?: FormulaProfile): (path: readonly
|
|
|
3261
3342
|
* @throws {MergeError} The language and the kit have a conflict.
|
|
3262
3343
|
*/
|
|
3263
3344
|
export declare function formulaMachine(profile?: FormulaProfile, more?: MachinePart): Machine;
|
|
3264
|
-
//#endregion
|
|
3265
|
-
//#region src/codec.d.ts
|
|
3266
3345
|
/** The domains of a machine, by their names. */
|
|
3267
3346
|
type Domains = Readonly<Record<string, Domain>> | undefined;
|
|
3268
3347
|
/**
|
|
@@ -3281,7 +3360,8 @@ export declare function decodeDomain(data: Json, domains: Domains): Result;
|
|
|
3281
3360
|
*
|
|
3282
3361
|
* - A value that JSON writes exactly stays as it is. A literal with the shape of an envelope goes into `lit`.
|
|
3283
3362
|
* - `NaN`, an infinity and `-0` become `ext.number`, and `undefined` becomes `ext.undefined`.
|
|
3284
|
-
* - A member of a domain with a codec becomes `ext.domain`. The
|
|
3363
|
+
* - A member of a domain with a codec becomes `ext.domain`. The codec of a domain under another domain comes first
|
|
3364
|
+
* (EXT.SPECIFIC, D109). The order of the names decides between unrelated domains.
|
|
3285
3365
|
* - A list or a plain record with such a value becomes the construct `list` or `record`.
|
|
3286
3366
|
*
|
|
3287
3367
|
* @param machine - The machine, or only its domains.
|
|
@@ -3299,8 +3379,6 @@ export declare function encodeValue(machine: Pick<Machine, "domains">, value: un
|
|
|
3299
3379
|
* @returns The value, or the error of the evaluation.
|
|
3300
3380
|
*/
|
|
3301
3381
|
export declare function decodeValue(machine: Machine, doc: unknown): Result;
|
|
3302
|
-
//#endregion
|
|
3303
|
-
//#region src/reference.d.ts
|
|
3304
3382
|
/**
|
|
3305
3383
|
* The definitional code of the reference, by evaluator name. The reference cannot read compiled code, thus each
|
|
3306
3384
|
* compiled evaluator or runner of a machine needs a definition here. A function evaluator needs none.
|
|
@@ -3386,8 +3464,6 @@ export declare const STD_DEFINITIONS: Definitions;
|
|
|
3386
3464
|
* @returns The definitions, by evaluator name.
|
|
3387
3465
|
*/
|
|
3388
3466
|
export declare function formulaDefinitions(profile?: FormulaProfile): Definitions;
|
|
3389
|
-
//#endregion
|
|
3390
|
-
//#region src/agree.d.ts
|
|
3391
3467
|
/**
|
|
3392
3468
|
* A tier that `agree` compares with the plan.
|
|
3393
3469
|
*
|
|
@@ -3546,8 +3622,6 @@ interface AgreeRunOptions extends Omit<AgreeOptions, "other" | "perform"> {
|
|
|
3546
3622
|
* @returns The result of the plan, or the first tier that disagrees and the reason.
|
|
3547
3623
|
*/
|
|
3548
3624
|
export declare function agreeRun(machine: Machine, doc: unknown, context?: Context, options?: AgreeRunOptions): Promise<Agreement>;
|
|
3549
|
-
//#endregion
|
|
3550
|
-
//#region src/conform.d.ts
|
|
3551
3625
|
/**
|
|
3552
3626
|
* An obligation that `conforms` checks. `C1` to `C8` are the obligations of host code in `docs/SEMANTICS.md`. `local`
|
|
3553
3627
|
* and `agree` are two premises of the simulation of the plan (SIM-PLAN).
|
|
@@ -3564,8 +3638,10 @@ export declare function agreeRun(machine: Machine, doc: unknown, context?: Conte
|
|
|
3564
3638
|
* - `agree`: compiled code gives the result of its definition for the reference interpreter.
|
|
3565
3639
|
* - `truth`: the own `truthy` of a formula profile gives `true` or `false` for each member of its `truthType` (D86).
|
|
3566
3640
|
* Only `formula.if`, `formula.and` and `formula.or` of the formula kit get this check.
|
|
3641
|
+
* - `cover`: each sample of a covered domain of the machine is in one domain of each cover of the domain (D94). Each
|
|
3642
|
+
* evaluator and each runner gets this check, because `fits` trusts the covers for each program.
|
|
3567
3643
|
*/
|
|
3568
|
-
type Obligation = "C1" | "C2" | "C3" | "C4" | "C5" | "C6" | "C7" | "C8" | "local" | "agree" | "truth";
|
|
3644
|
+
type Obligation = "C1" | "C2" | "C3" | "C4" | "C5" | "C6" | "C7" | "C8" | "local" | "agree" | "truth" | "cover";
|
|
3569
3645
|
/** The probe of a finding: the document, the result of each probe part, the capabilities and the handler. */
|
|
3570
3646
|
interface ConformProbe {
|
|
3571
3647
|
/** The text of the type of the document. */
|
|
@@ -3645,7 +3721,8 @@ interface ConformOptions {
|
|
|
3645
3721
|
* compiled code with its definition. The finding of an obligation names the first probe that breaks it. An empty list
|
|
3646
3722
|
* means that each probe conforms.
|
|
3647
3723
|
*
|
|
3648
|
-
* The check `truth` tests the declared truth of a formula profile (D86).
|
|
3724
|
+
* The check `truth` tests the declared truth of a formula profile (D86). The check `cover` tests the covers of the
|
|
3725
|
+
* domains of the machine from samples (D94).
|
|
3649
3726
|
*
|
|
3650
3727
|
* @param machine - The machine with the code and the world of the kinds.
|
|
3651
3728
|
* @param name - The name of the evaluator or of the runner. A runner wins over an evaluator of the same name.
|
|
@@ -3655,8 +3732,6 @@ interface ConformOptions {
|
|
|
3655
3732
|
* @throws {Error} The machine has no code with the name, or no kind names it and the options give no types.
|
|
3656
3733
|
*/
|
|
3657
3734
|
export declare function conforms(machine: Machine, name: string, options?: ConformOptions): readonly Finding[];
|
|
3658
|
-
//#endregion
|
|
3659
|
-
//#region src/same.d.ts
|
|
3660
3735
|
/**
|
|
3661
3736
|
* This function tells if two results are the same for an early cutoff (RESULT.SAME). A schedule uses it to stop the
|
|
3662
3737
|
* work when a part that evaluates again gives the same result. A wrong `true` keeps a stale value, but a wrong `false`
|
|
@@ -3678,8 +3753,6 @@ export declare function conforms(machine: Machine, name: string, options?: Confo
|
|
|
3678
3753
|
* @returns `true` when the results are the same.
|
|
3679
3754
|
*/
|
|
3680
3755
|
export declare function sameResult(a: Result<unknown>, b: Result<unknown>, equal?: (a: unknown, b: unknown) => boolean | undefined): boolean;
|
|
3681
|
-
//#endregion
|
|
3682
|
-
//#region src/reads.d.ts
|
|
3683
3756
|
/** The answer of `verifyReads`: the old result stays valid, or the first read that reaches another thing. */
|
|
3684
3757
|
type ReadsCheck = {
|
|
3685
3758
|
readonly same: true;
|
|
@@ -3691,7 +3764,38 @@ type ReadsCheck = {
|
|
|
3691
3764
|
readonly read: Read;
|
|
3692
3765
|
/** What the path of that read reaches in the new context. */
|
|
3693
3766
|
readonly now: Result;
|
|
3767
|
+
/**
|
|
3768
|
+
* `true` when the read reaches the same thing by `sameResult`, but the print of that thing changed
|
|
3769
|
+
* (READS.IN-PLACE). Only the option `prints` gives this mark.
|
|
3770
|
+
*/
|
|
3771
|
+
readonly inPlace?: true;
|
|
3694
3772
|
};
|
|
3773
|
+
/** The options of `printReads` (READS.IN-PLACE, D112). */
|
|
3774
|
+
interface PrintOptions {
|
|
3775
|
+
/**
|
|
3776
|
+
* The most entries in the print of one value. Each value, each field name and each mark counts as one entry. A
|
|
3777
|
+
* larger value gets no print, and `verifyReads` then gives its read as changed. The default is 10000.
|
|
3778
|
+
*/
|
|
3779
|
+
readonly limit?: number;
|
|
3780
|
+
/**
|
|
3781
|
+
* The stamp of the host for an object, for example the version of a host thing. A stamp other than `undefined`
|
|
3782
|
+
* takes the place of the fields of that object in the print. A stamp compares with `Object.is`.
|
|
3783
|
+
*
|
|
3784
|
+
* @param value - An object of the value of a read.
|
|
3785
|
+
* @returns The stamp, or `undefined` for the walk of the fields.
|
|
3786
|
+
*/
|
|
3787
|
+
readonly stamp?: (value: object) => unknown;
|
|
3788
|
+
}
|
|
3789
|
+
/**
|
|
3790
|
+
* The prints of a list of reads, from `printReads`. `verifyReads` takes them with the option `prints`. The prints
|
|
3791
|
+
* keep their options, thus the verification walks each value with the same rules.
|
|
3792
|
+
*/
|
|
3793
|
+
interface ReadPrints {
|
|
3794
|
+
/** The print of each read, at the index of the read. A read without an object in its value has no print. */
|
|
3795
|
+
readonly prints: readonly (readonly unknown[] | undefined)[];
|
|
3796
|
+
/** The options of the prints. */
|
|
3797
|
+
readonly options: PrintOptions;
|
|
3798
|
+
}
|
|
3695
3799
|
/** The options of `verifyReads`. */
|
|
3696
3800
|
interface VerifyOptions {
|
|
3697
3801
|
/**
|
|
@@ -3703,7 +3807,31 @@ interface VerifyOptions {
|
|
|
3703
3807
|
* @returns `true` when the two things are the same, or `undefined` for the rules of `sameResult`.
|
|
3704
3808
|
*/
|
|
3705
3809
|
readonly equal?: (a: unknown, b: unknown) => boolean | undefined;
|
|
3810
|
+
/**
|
|
3811
|
+
* The prints of the reads, from `printReads` after the evaluation (READS.IN-PLACE). When the prints are given, a
|
|
3812
|
+
* read that reaches the same thing also compares its print. Thus a change in place of a host value is a changed
|
|
3813
|
+
* read. Without the prints, the verification does no work for them.
|
|
3814
|
+
*/
|
|
3815
|
+
readonly prints?: ReadPrints;
|
|
3706
3816
|
}
|
|
3817
|
+
/**
|
|
3818
|
+
* This function gives the prints of the values of a list of reads (READS.IN-PLACE, D112). A host starts it after
|
|
3819
|
+
* the evaluation, and it gives the prints to `verifyReads` with the option `prints`.
|
|
3820
|
+
*
|
|
3821
|
+
* - The print of a value walks its lists, its plain records and the own enumerable fields of each other object. A
|
|
3822
|
+
* date adds its time, and a map or a set adds its entries.
|
|
3823
|
+
* - A read that is not free, a read that reached an error and a read with a primitive value get no print.
|
|
3824
|
+
* - A cycle ends, because the walk visits each object one time.
|
|
3825
|
+
* - A value with more entries than the limit gets no print. `verifyReads` then gives that read as changed.
|
|
3826
|
+
*
|
|
3827
|
+
* The walk does not see the state in a closure or a private field. It does not see a field with a symbol name, a
|
|
3828
|
+
* field that is not enumerable or the value of a getter. A host gives a stamp for such an object, for example its version.
|
|
3829
|
+
*
|
|
3830
|
+
* @param reads - The reads of the evaluation, from the option `reads`.
|
|
3831
|
+
* @param options - The limit and the stamp of the host.
|
|
3832
|
+
* @returns The prints, for the option `prints` of `verifyReads`.
|
|
3833
|
+
*/
|
|
3834
|
+
export declare function printReads(reads: readonly Read[], options?: PrintOptions): ReadPrints;
|
|
3707
3835
|
/**
|
|
3708
3836
|
* This function tells if an old result stays valid in a new context (READS.VERIFY, D26). It resolves the path of
|
|
3709
3837
|
* each free read again, in the order of the list, and it compares what the path reaches with `sameResult`. It stops at
|
|
@@ -3719,17 +3847,16 @@ interface VerifyOptions {
|
|
|
3719
3847
|
* extension of a profile can read outside `resolve`. The schedule asks `factsOf` first.
|
|
3720
3848
|
*
|
|
3721
3849
|
* The values of the context must not change in place, as PLAN.CACHE says for the documents. A value that changed in
|
|
3722
|
-
* place is the same object, thus
|
|
3850
|
+
* place is the same object, thus `sameResult` cannot see the change. The option `prints` finds such a change
|
|
3851
|
+
* (READS.IN-PLACE). The prints come from `printReads` after the evaluation, and the answer then has the mark `inPlace`.
|
|
3723
3852
|
*
|
|
3724
3853
|
* @param target - The machine of the evaluation, or its plan.
|
|
3725
3854
|
* @param reads - The reads of the evaluation, from the option `reads`.
|
|
3726
3855
|
* @param context - The new context.
|
|
3727
|
-
* @param options - The rule of the host for two things.
|
|
3856
|
+
* @param options - The rule of the host for two things, and the prints of the reads.
|
|
3728
3857
|
* @returns `{ same: true }` when each free read reaches the same thing, or else the first changed read.
|
|
3729
3858
|
*/
|
|
3730
3859
|
export declare function verifyReads(target: Machine | Plan, reads: readonly Read[], context: Context, options?: VerifyOptions): ReadsCheck;
|
|
3731
|
-
//#endregion
|
|
3732
|
-
//#region src/durable.d.ts
|
|
3733
3860
|
/** The two epochs of a host (DURABLE.EPOCHS). Each epoch counts the changes of its level. */
|
|
3734
3861
|
interface Epochs {
|
|
3735
3862
|
/** The count of the changes of the structure: a new machine, or an edit of a document. */
|
|
@@ -3760,6 +3887,11 @@ interface DurableOptions {
|
|
|
3760
3887
|
readonly volatile?: FactsOptions["volatile"];
|
|
3761
3888
|
/** The rule of the host for two things, as in `verifyReads`. */
|
|
3762
3889
|
readonly equal?: VerifyOptions["equal"];
|
|
3890
|
+
/**
|
|
3891
|
+
* The check of changes in place (READS.IN-PLACE, D112). With it, the cache keeps the prints of the reads of each
|
|
3892
|
+
* pure document, and a verification compares them. `true` gives the default limit. Without it, the cache makes no prints.
|
|
3893
|
+
*/
|
|
3894
|
+
readonly inPlace?: true | PrintOptions;
|
|
3763
3895
|
}
|
|
3764
3896
|
/**
|
|
3765
3897
|
* A cache of plans, facts and results with two levels of durability (D30). A host or a schedule tells the cache each
|
|
@@ -3830,15 +3962,14 @@ interface Durable {
|
|
|
3830
3962
|
* and each result (DURABLE.STRUCTURE).
|
|
3831
3963
|
*
|
|
3832
3964
|
* The host keeps two promises. In one data epoch, the context of a key gives the same data. The values of a
|
|
3833
|
-
* context and the documents do not change in place, as PLAN.CACHE and `verifyReads` say.
|
|
3965
|
+
* context and the documents do not change in place, as PLAN.CACHE and `verifyReads` say. The option `inPlace`
|
|
3966
|
+
* finds a change in place of a value that a pure document read (READS.IN-PLACE).
|
|
3834
3967
|
*
|
|
3835
3968
|
* @param machine - The machine of the first structure epoch.
|
|
3836
|
-
* @param options - The type of a bare root value, the verb, the volatile reads
|
|
3969
|
+
* @param options - The type of a bare root value, the verb, the volatile reads, the rule of the host and the check of changes in place.
|
|
3837
3970
|
* @returns The cache.
|
|
3838
3971
|
*/
|
|
3839
3972
|
export declare function durable(machine: Machine, options?: DurableOptions): Durable;
|
|
3840
|
-
//#endregion
|
|
3841
|
-
//#region src/schedule.d.ts
|
|
3842
3973
|
/** One edge of a graph of nodes: a static read of a node from the document of another node (SCHED.EDGES). */
|
|
3843
3974
|
interface NodeEdge {
|
|
3844
3975
|
/**
|
|
@@ -3993,8 +4124,6 @@ export declare function edgesOf(facts: DocFacts): readonly NodeEdge[];
|
|
|
3993
4124
|
* @returns The schedule.
|
|
3994
4125
|
*/
|
|
3995
4126
|
export declare function schedule(machine: Machine, options?: ScheduleOptions): Schedule;
|
|
3996
|
-
//#endregion
|
|
3997
|
-
//#region src/generate.d.ts
|
|
3998
4127
|
/** A source of random numbers with a seed. The same seed gives the same numbers. */
|
|
3999
4128
|
interface Random {
|
|
4000
4129
|
/** This function gives a number from 0 up to 1, without 1. */
|
|
@@ -4074,8 +4203,6 @@ export declare function typesOf(world: World): readonly (readonly Key[])[];
|
|
|
4074
4203
|
* @returns The document, as JSON.
|
|
4075
4204
|
*/
|
|
4076
4205
|
export declare function generate(world: World, options: GenerateOptions): unknown;
|
|
4077
|
-
//#endregion
|
|
4078
|
-
//#region src/meaning.d.ts
|
|
4079
4206
|
/**
|
|
4080
4207
|
* The smallest interface of the engine of a host that `agreeSchedule` examines (SCHED.AGREES). The demand schedule of
|
|
4081
4208
|
* `schedule` has this interface.
|
|
@@ -4256,8 +4383,6 @@ type ScheduleAgreement = {
|
|
|
4256
4383
|
* @returns What the harness reached, or the first read whose answer differs from the answer from scratch.
|
|
4257
4384
|
*/
|
|
4258
4385
|
export declare function agreeSchedule(engine: ScheduleEngineFactory, options?: AgreeScheduleOptions): ScheduleAgreement;
|
|
4259
|
-
//#endregion
|
|
4260
|
-
//#region src/graph.d.ts
|
|
4261
4386
|
/** One edge of a graph of nodes: a read of a node by another node. `NodeEdge` of a schedule is such an edge. */
|
|
4262
4387
|
interface GraphEdge<Id> {
|
|
4263
4388
|
/** The node that the read reaches. It is `undefined` when the read can reach each node (GRAPH.UNKNOWN). */
|
|
@@ -4357,8 +4482,79 @@ export declare function necessary<Id>(graph: NodeGraph<Id>, observed: Iterable<I
|
|
|
4357
4482
|
* @returns The cycles, deepest first.
|
|
4358
4483
|
*/
|
|
4359
4484
|
export declare function cycles<Id>(graph: NodeGraph<Id>): readonly GraphCycle<Id>[];
|
|
4360
|
-
|
|
4361
|
-
|
|
4485
|
+
/** One vertex of the graph of attribute instances: one attribute of one node of the decorated tree (D107). */
|
|
4486
|
+
interface AttributeVertex {
|
|
4487
|
+
/** The name of the vertex: the JSON text of the place of the node with the name of the attribute after it. */
|
|
4488
|
+
readonly id: string;
|
|
4489
|
+
/** The place of the document of the node. */
|
|
4490
|
+
readonly place: readonly Key[];
|
|
4491
|
+
readonly attribute: string;
|
|
4492
|
+
/** The text of the type of the node. */
|
|
4493
|
+
readonly type: string;
|
|
4494
|
+
}
|
|
4495
|
+
/** One read of an attribute by the code of another attribute (D107). */
|
|
4496
|
+
interface AttributeEdge {
|
|
4497
|
+
/** The vertex that the read reaches. It is `undefined` when only the run knows it: the read depends on a value. */
|
|
4498
|
+
readonly from: string | undefined;
|
|
4499
|
+
/** The vertex whose code makes the read. */
|
|
4500
|
+
readonly to: string;
|
|
4501
|
+
/** `true` when only a lazy part reaches the read, or when an earlier rung can answer first (FACTS.LAZY). */
|
|
4502
|
+
readonly lazy: boolean;
|
|
4503
|
+
/** The place of the reference document. A read of a rung has the place of the node. */
|
|
4504
|
+
readonly place: readonly Key[];
|
|
4505
|
+
}
|
|
4506
|
+
/** One cycle of the graph of attribute instances (D107). */
|
|
4507
|
+
interface AttributeCycle {
|
|
4508
|
+
/** The vertices of the cycle, in the order of the graph. */
|
|
4509
|
+
readonly vertices: readonly string[];
|
|
4510
|
+
/** `true` when the eager reads with a known source close the cycle (GRAPH.CYCLE). */
|
|
4511
|
+
readonly certain: boolean;
|
|
4512
|
+
}
|
|
4513
|
+
/** The graph of attribute instances of a document (TREE.GRAPH). */
|
|
4514
|
+
interface AttributeGraph {
|
|
4515
|
+
/** The vertices, by name, in the order of the document. */
|
|
4516
|
+
readonly vertices: ReadonlyMap<string, AttributeVertex>;
|
|
4517
|
+
/** The edges, in the order of the code of each vertex. */
|
|
4518
|
+
readonly edges: readonly AttributeEdge[];
|
|
4519
|
+
/** The graph for the analysis of `graph.ts`: each vertex with the vertices that it reads. */
|
|
4520
|
+
readonly graph: NodeGraph<string>;
|
|
4521
|
+
/** The edges with an unknown source. The check of the cycles is not complete for them: only the run knows them. */
|
|
4522
|
+
readonly unknown: readonly AttributeEdge[];
|
|
4523
|
+
/** The cycles of the graph, deepest first. */
|
|
4524
|
+
readonly cycles: readonly AttributeCycle[];
|
|
4525
|
+
}
|
|
4526
|
+
/** The options of `attributeGraph`. */
|
|
4527
|
+
interface AttributeGraphOptions {
|
|
4528
|
+
/** The type of a bare root value. */
|
|
4529
|
+
readonly declaredType?: string;
|
|
4530
|
+
}
|
|
4531
|
+
/**
|
|
4532
|
+
* This function gives the name of a vertex of the graph of attribute instances. The name is the JSON text of the
|
|
4533
|
+
* place of the node, with the name of the attribute after it.
|
|
4534
|
+
*
|
|
4535
|
+
* @param place - The place of the document of the node.
|
|
4536
|
+
* @param attribute - The name of the attribute.
|
|
4537
|
+
* @returns The name of the vertex.
|
|
4538
|
+
*/
|
|
4539
|
+
export declare function attributeVertexId(place: readonly Key[], attribute: string): string;
|
|
4540
|
+
/**
|
|
4541
|
+
* This function gives the graph of attribute instances of a document (TREE.GRAPH, R3 P5, D107). It has one vertex for
|
|
4542
|
+
* each attribute of each node of the decorated tree. It has one edge for each read of the code of an attribute.
|
|
4543
|
+
*
|
|
4544
|
+
* - A path from `self` reads the attribute of the node. `self.parent` goes to the parent node.
|
|
4545
|
+
* - The step `nearest` with the key `parent` depends only on the structure, thus it goes to a node of the document.
|
|
4546
|
+
* - The rungs of the ladder read too: `names.prev` of `down` reads the previous sibling, and a fold reads each child.
|
|
4547
|
+
* - A read that depends on the value of an attribute gets an edge with an unknown source.
|
|
4548
|
+
*
|
|
4549
|
+
* The walk is the walk of `check`, with its rules for the self of each document (D106). The evaluator of the kernel
|
|
4550
|
+
* does not use the graph (D3).
|
|
4551
|
+
*
|
|
4552
|
+
* @param machine - The world and the code of the evaluators.
|
|
4553
|
+
* @param doc - The document, as JSON.
|
|
4554
|
+
* @param options - The type of a bare root value.
|
|
4555
|
+
* @returns The vertices, the edges, the graph for the analysis, the reads that only the run knows and the cycles.
|
|
4556
|
+
*/
|
|
4557
|
+
export declare function attributeGraph(machine: Machine, doc: unknown, options?: AttributeGraphOptions): AttributeGraph;
|
|
4362
4558
|
/** One effect of a log: its address, its request and its outcome. */
|
|
4363
4559
|
interface ReplayEntry {
|
|
4364
4560
|
/** The address of the effect (RUN.ADDRESS), for example `1#0` or `all0.1/1#0`. */
|
|
@@ -4471,7 +4667,8 @@ interface ReplayErrorJson {
|
|
|
4471
4667
|
/**
|
|
4472
4668
|
* The JSON form of a cause without a term document that is a list or a plain record with an exception at some depth
|
|
4473
4669
|
* (RUN.REPLAY-CAUSE-PARTS, D87). It is a list of parts, the part `record` or the part `share`. The index 0 of `loop` is its
|
|
4474
|
-
* first exception, and the index 0 of `share` is its first list or record.
|
|
4670
|
+
* first exception, and the index 0 of `share` is its first list or record. Since D101, a list or a record cause that
|
|
4671
|
+
* holds a container at two places is also `causeParts` (RUN.REPLAY-SHARED-VALUES).
|
|
4475
4672
|
*/
|
|
4476
4673
|
readonly causeParts?: ReplayCausePartsJson;
|
|
4477
4674
|
/** The names of the items of `causeParts` without a form, for example `cause.send`. This list is only a note. */
|
|
@@ -4494,13 +4691,18 @@ type ReplayCausePartsJson = readonly ReplayPartsJson[] | {
|
|
|
4494
4691
|
interface ReplayExceptionJson {
|
|
4495
4692
|
readonly name: string;
|
|
4496
4693
|
readonly message: string;
|
|
4497
|
-
/**
|
|
4694
|
+
/**
|
|
4695
|
+
* The term documents of the own fields of the exception that `encodeValue` writes, for example `code` or `errno`. A list
|
|
4696
|
+
* or a plain record that two places of the error share is in `parts` (RUN.REPLAY-SHARED-VALUES, D101).
|
|
4697
|
+
*/
|
|
4498
4698
|
readonly fields?: Readonly<Record<string, Json>>;
|
|
4499
4699
|
/**
|
|
4500
4700
|
* The own enumerable fields without a term document that are an exception, a list or a plain record (RUN.REPLAY-FIELDS,
|
|
4501
4701
|
* D78, D82). An example is a list `errors` on an `Error`. A list is a list of parts, and a record is the part `record`.
|
|
4502
4702
|
* Each exception in them has the rule of a cause. A container without a form in it is a name in `dropped`. A container
|
|
4503
4703
|
* that an earlier place holds is the part `share` (D88).
|
|
4704
|
+
*
|
|
4705
|
+
* Since D101, a shared container with a term document is in `parts` too, and so is each container that holds it.
|
|
4504
4706
|
*/
|
|
4505
4707
|
readonly parts?: Readonly<Record<string, ReplayPartsJson>>;
|
|
4506
4708
|
/**
|
|
@@ -4522,7 +4724,8 @@ interface ReplayExceptionJson {
|
|
|
4522
4724
|
readonly loop?: number;
|
|
4523
4725
|
/**
|
|
4524
4726
|
* The JSON form of a cause without a term document that is a list or a plain record with an exception at some depth
|
|
4525
|
-
* (RUN.REPLAY-CAUSE-PARTS, D87). Each exception in it has the rule of a cause, also a `loop`.
|
|
4727
|
+
* (RUN.REPLAY-CAUSE-PARTS, D87). Each exception in it has the rule of a cause, also a `loop`. Since D100, a list or a
|
|
4728
|
+
* record without an exception is also `causeParts` when an item has a form (RUN.REPLAY-CAUSE-ITEMS).
|
|
4526
4729
|
*/
|
|
4527
4730
|
readonly causeParts?: ReplayCausePartsJson;
|
|
4528
4731
|
}
|
|
@@ -4568,8 +4771,12 @@ type ReplayPartsJson = ReplayPartJson | readonly ReplayPartsJson[];
|
|
|
4568
4771
|
* (RUN.REPLAY-FIELDS, D78, D82). An item of a list without a form is the mark `dropped` at its place.
|
|
4569
4772
|
* - A cause without a term document that is a list or a plain record with an exception is in `causeParts`
|
|
4570
4773
|
* (RUN.REPLAY-CAUSE-PARTS, D87). The rule is the same for the cause of an exception and of an error value.
|
|
4774
|
+
* - The cause of an exception is also in `causeParts` without an exception in it, when an item has a form
|
|
4775
|
+
* (RUN.REPLAY-CAUSE-ITEMS, D100). Each item without a form is a name in `dropped`, for example `cause.send`.
|
|
4571
4776
|
* - A list or a record of parts that an earlier place of one error holds is the part `share` with its index
|
|
4572
4777
|
* (RUN.REPLAY-SHARED, D88). This rule also covers a container that holds itself.
|
|
4778
|
+
* - A list or a plain record with a term document that two places of one error share is a container of parts
|
|
4779
|
+
* (RUN.REPLAY-SHARED-VALUES, D101). Each later place is a share. A member of a domain stays a term document.
|
|
4573
4780
|
* - An outcome that the log does not have stays absent.
|
|
4574
4781
|
*
|
|
4575
4782
|
* @param machine - The machine of the run, or only its domains.
|
|
@@ -4591,8 +4798,6 @@ export declare function encodeLog(machine: Pick<Machine, "domains">, log: Replay
|
|
|
4591
4798
|
* @returns The log for `replayer`, or `#VALUE!` with the place of the first field that it cannot read.
|
|
4592
4799
|
*/
|
|
4593
4800
|
export declare function decodeLog(machine: Pick<Machine, "domains">, data: unknown): Result<ReplayLog>;
|
|
4594
|
-
//#endregion
|
|
4595
|
-
//#region src/providers.d.ts
|
|
4596
4801
|
/** The type that a provider reads, and the problems of the reading. Each problem tells what the type does not test. */
|
|
4597
4802
|
interface TypeReading {
|
|
4598
4803
|
readonly type: ValueType;
|
|
@@ -4639,6 +4844,5 @@ interface SampleOptions {
|
|
|
4639
4844
|
* @returns The type.
|
|
4640
4845
|
*/
|
|
4641
4846
|
export declare function typeFromSamples(values: readonly unknown[], options?: SampleOptions): ValueType;
|
|
4642
|
-
|
|
4643
|
-
export type { AgreeOptions, AgreeRunOptions, AgreeScheduleOptions, Agreement, Alias, AllOptions, Answer, AskOptions, AttributeDeclaration, AttributeRung, AttributeTrace, Cap, CapsRule, CheckOptions, Classification, Closure, Code, CompileInput, CompiledEvaluator, CompiledPart, CompiledRunner, ConformOptions, ConformProbe, Construct, Context, Part as ContextPart, Definitions, DerefCode, DocFacts, DocParts, DocVisit, Domain, DomainCodec, DomainExtension, Durable, DurableCounts, DurableOptions, Edge, Effect, EffectsOptions, Envelope, Epochs, ErrorCode, EvalError, EvalFn, EvalInput, EvalOptions, EvaluateOptions, Evaluator, ExtFn, FactsOptions, Failed, Finding, FormulaProfile, GenerateOptions, Give, GraphCycle, GraphEdge, GraphNode, GraphOptions, Header, Hop, HopBy, HostThing, Issue, Journal, Json, JsonRecord, KernelCode, Key, Kind, KindFacts, KindSource, LazyOp, LazyRule, Lookup, Machine, MachinePart, MergeConflict, MergePath, NamesSource, Namespace, Navigator, NearestOptions, NodeEdge, NodeGraph, NodeInfo, NodeRunOptions, Obligation, OpFn, OrderProblem, Outcome, ParseResult, Part$1 as Part, PartInfo, Shape as PartShape, PartSlot, PartType, PartsSpec, Perform, Plan, PlanRunOptions, PrepareOptions, Random, Read, ReadsCheck, Recorder, RefUse, ReferenceOptions, ReferenceRunOptions, ReplayCausePartsJson, ReplayEntry, ReplayEntryJson, ReplayErrorJson, ReplayExceptionJson, ReplayLog, ReplayLogJson, ReplayOptions, ReplayPartJson, ReplayPartsJson, ReplayResultJson, ReplaySettle, Resolution, ResolveCode, ResolveOptions, Result, Root, RootTypes, Run, RunCode, RunFn, RunInput, RunOptions, RunPart, Rung, Runner, Runtime, SampleOptions, Schedule, ScheduleAgreement, ScheduleAgreementCounts, ScheduleCounts, ScheduleEngine, ScheduleEngineFactory, ScheduleEngineStart, ScheduleOptions, ScopeRule, Shape$1 as Shape, Side, Signature, Split, StaticRead, Step, StepSpec, Steps, StopSignal, Stored, SyntaxAssoc, SyntaxCalls, SyntaxEnvelopes, SyntaxFixity, SyntaxForm, SyntaxFormArgs, SyntaxHeader, SyntaxIssue, SyntaxLiterals, SyntaxOperator, SyntaxProfile, SyntaxRefPattern, SyntaxRefs, Thing, Tier, TierInput, TierResult, TraceNode, TreeContract, TypeInput, TypeIssue, TypeProblem, TypeReading, TypeRef, TypeRule, Typed, Typing, Use, ValueType, VerbEffects, VerifyOptions, WalkInput, WalkOptions, WalkProblem, WalkResult, Walker, World, WorldEntry, WorldIssue, WorldPart };
|
|
4847
|
+
export type { AgreeOptions, AgreeRunOptions, AgreeScheduleOptions, Agreement, Alias, AllOptions, Answer, AskOptions, AttributeAnswer, AttributeCell, AttributeCycle, AttributeDeclaration, AttributeEdge, AttributeGraph, AttributeGraphOptions, AttributeRung, AttributeTrace, AttributeVertex, Cap, CapsRule, CheckOptions, Classification, Closure, Code, CompileInput, CompiledEvaluator, CompiledPart, CompiledRunner, ConformOptions, ConformProbe, Construct, Context, Part as ContextPart, Declared, Definitions, DerefCode, DocFacts, DocParts, DocVisit, Domain, DomainCodec, DomainExtension, Durable, DurableCounts, DurableOptions, Edge, Effect, EffectsOptions, Envelope, Epochs, ErrorCode, EvalError, EvalFn, EvalInput, EvalOptions, EvaluateOptions, Evaluator, ExtFn, FactsOptions, Failed, Finding, FormulaProfile, GenerateOptions, Give, GraphCycle, GraphEdge, GraphNode, GraphOptions, Header, Hop, HopBy, HostThing, Issue, Journal, Json, JsonRecord, KernelCode, Key, Kind, KindFacts, KindSource, LazyOp, LazyRule, Lookup, Machine, MachinePart, MergeConflict, MergePath, NamesSource, Namespace, Navigator, NearestOptions, NodeEdge, NodeGraph, NodeInfo, NodeRunOptions, Obligation, OpFn, OrderProblem, Outcome, ParseResult, Part$1 as Part, PartInfo, Shape as PartShape, PartSlot, PartType, PartsSpec, Perform, Plan, PlanRunOptions, PrepareOptions, PrintOptions, Random, Read, ReadPrints, ReadsCheck, Recorder, RefUse, ReferenceOptions, ReferenceRunOptions, ReplayCausePartsJson, ReplayEntry, ReplayEntryJson, ReplayErrorJson, ReplayExceptionJson, ReplayLog, ReplayLogJson, ReplayOptions, ReplayPartJson, ReplayPartsJson, ReplayResultJson, ReplaySettle, Resolution, ResolveCode, ResolveOptions, Result, Root, RootTypes, Run, RunCode, RunFn, RunInput, RunOptions, RunPart, Rung, Runner, Runtime, SampleOptions, Schedule, ScheduleAgreement, ScheduleAgreementCounts, ScheduleCounts, ScheduleEngine, ScheduleEngineFactory, ScheduleEngineStart, ScheduleOptions, ScopeRule, Shape$1 as Shape, Side, Signature, Split, StaticRead, Step, StepSpec, Steps, StopSignal, Stored, SyntaxAssoc, SyntaxCalls, SyntaxEnvelopes, SyntaxFixity, SyntaxForm, SyntaxFormArgs, SyntaxHeader, SyntaxIssue, SyntaxLiterals, SyntaxOperator, SyntaxProfile, SyntaxRefPattern, SyntaxRefs, Thing, Tier, TierInput, TierResult, TraceNode, TreeContract, TreeOptions, TypeInput, TypeIssue, TypeProblem, TypeReading, TypeRef, TypeRule, Typed, Typing, Use, ValueType, VerbEffects, VerifyOptions, WalkInput, WalkOptions, WalkProblem, WalkResult, Walker, World, WorldEntry, WorldIssue, WorldOptions, WorldPart };
|
|
4644
4848
|
//# sourceMappingURL=index.d.ts.map
|