@bitspark/horos 0.9.0 → 0.11.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/README.md +3 -3
- package/dist/src/cli.js +9 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/core.d.ts +1 -1
- package/dist/src/core.js +172 -62
- package/dist/src/core.js.map +1 -1
- package/dist/src/diagnose.d.ts +36 -3
- package/dist/src/diagnose.js +465 -150
- package/dist/src/diagnose.js.map +1 -1
- package/package.json +10 -10
package/dist/src/diagnose.d.ts
CHANGED
|
@@ -5,21 +5,53 @@ export type Limit = "recursion_depth";
|
|
|
5
5
|
export declare function limitValue(l: Limit): number;
|
|
6
6
|
/** The completed/incomplete classification of a checking attempt. */
|
|
7
7
|
export type Verdict = "conforms" | "mismatch" | "not_well_formed" | "exhausted";
|
|
8
|
+
/** The kinds of value path step that select by a 0-based index in canonical order. */
|
|
9
|
+
export type StepKind = "item" | "elem" | "key" | "value";
|
|
10
|
+
/**
|
|
11
|
+
* One step of a value path: `item` of a bare tuple, `elem` of a list or set, `key` or
|
|
12
|
+
* `value` of a map entry, or the record `field` with this name.
|
|
13
|
+
*/
|
|
14
|
+
export type Step = {
|
|
15
|
+
readonly kind: StepKind;
|
|
16
|
+
readonly index: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "field";
|
|
19
|
+
readonly name: string;
|
|
20
|
+
};
|
|
21
|
+
/** Why the check failed at a location (ADR 0009). */
|
|
22
|
+
export type Reason = "refused" | "missing-field" | "extra-field" | "no-alternative" | "complement" | "limit" | "not-descriptor" | "unknown-constructor" | "arity" | "argument" | "duplicate-field" | "unbound-ref" | "unguarded-ref";
|
|
23
|
+
/**
|
|
24
|
+
* Where a check failed: the path into the value, the position of the descriptor at fault
|
|
25
|
+
* (tuple-item indices from the root descriptor), and the reason. `field` names the record
|
|
26
|
+
* field for `missing-field` and `extra-field`; `arg` is the item index of the faulty argument
|
|
27
|
+
* for `argument`, `duplicate-field`, `unbound-ref` and `unguarded-ref`.
|
|
28
|
+
*/
|
|
29
|
+
export interface Location {
|
|
30
|
+
readonly path: readonly Step[];
|
|
31
|
+
readonly at: readonly number[];
|
|
32
|
+
readonly reason: Reason;
|
|
33
|
+
readonly field?: string;
|
|
34
|
+
readonly arg?: number;
|
|
35
|
+
}
|
|
8
36
|
/**
|
|
9
37
|
* A checking outcome that distinguishes a completed decision from a reached bound.
|
|
10
38
|
*
|
|
11
39
|
* `exhausted` is INCOMPLETE: a statement about THIS bounded attempt, never a claim that the
|
|
12
|
-
* value does or does not have the form, and never a refutation.
|
|
40
|
+
* value does or does not have the form, and never a refutation. Every outcome other than
|
|
41
|
+
* `conforms` names its location.
|
|
13
42
|
*/
|
|
14
43
|
export type Diagnosis = {
|
|
15
44
|
readonly verdict: "conforms";
|
|
16
45
|
} | {
|
|
17
46
|
readonly verdict: "mismatch";
|
|
47
|
+
readonly location: Location;
|
|
18
48
|
} | {
|
|
19
49
|
readonly verdict: "not_well_formed";
|
|
50
|
+
readonly location: Location;
|
|
20
51
|
} | {
|
|
21
52
|
readonly verdict: "exhausted";
|
|
22
53
|
readonly limit: Limit;
|
|
54
|
+
readonly location: Location;
|
|
23
55
|
};
|
|
24
56
|
/** Whether this outcome is a completed decision. */
|
|
25
57
|
export declare function isComplete(d: Diagnosis): boolean;
|
|
@@ -44,13 +76,14 @@ export declare function checkingProfile(): Profile;
|
|
|
44
76
|
/**
|
|
45
77
|
* Diagnose `wf(T)`: `conforms` when T is a well-formed descriptor, `not_well_formed` when it is
|
|
46
78
|
* conclusively not, and `exhausted` when the well-formedness traversal itself could not finish
|
|
47
|
-
* — the distinction horos-internal#211 asks for by name.
|
|
79
|
+
* — the distinction horos-internal#211 asks for by name. A non-conforming outcome names the
|
|
80
|
+
* descriptor position and, where one argument is at fault, its item index.
|
|
48
81
|
*/
|
|
49
82
|
export declare function diagnoseWf(t: Value): Diagnosis;
|
|
50
83
|
/**
|
|
51
84
|
* Diagnose `v : T`. Mirrors `conforms`: the `wf(T)` soundness gate runs first (spec §3 MUST),
|
|
52
85
|
* so a descriptor that is not well-formed yields `not_well_formed` and one whose
|
|
53
86
|
* well-formedness could not be decided yields `exhausted` — neither is reported as a mismatch
|
|
54
|
-
* of the value.
|
|
87
|
+
* of the value. Each carries the well-formedness location, with an empty value path.
|
|
55
88
|
*/
|
|
56
89
|
export declare function diagnose(v: Value, t: Value): Diagnosis;
|