@mark1russell7/coeval 0.9.0 → 0.11.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 +3 -3
- package/build/index.d.ts +62 -23
- package/build/index.d.ts.map +1 -1
- package/build/index.js +101 -29
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/conform.ts +15 -7
- package/src/evaluate.ts +35 -12
- package/src/formula.ts +34 -15
- package/src/generate.ts +7 -2
- package/src/index.ts +3 -0
- package/src/providers.ts +4 -3
- package/src/static.ts +35 -17
- package/src/types.ts +4 -2
- package/src/world.ts +31 -1
package/build/index.js
CHANGED
|
@@ -368,6 +368,21 @@ function equationType(kind) {
|
|
|
368
368
|
return parts?.of ?? parts?.rest?.of;
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
|
+
* This function gives the effects that the contract of a kind declares for a verb (VERB.EFFECTS, D49). For `eval`,
|
|
372
|
+
* the field `effects` declares them, and a kind without the field declares no effect. For another verb, the entry of
|
|
373
|
+
* `verbEffects` declares them. `check` and `conforms` read the declarations with this one function.
|
|
374
|
+
*
|
|
375
|
+
* @param kind - The kind.
|
|
376
|
+
* @param verb - The verb.
|
|
377
|
+
* @returns The declaration in the form of `effects`, or `undefined` when the contract does not declare the effects of
|
|
378
|
+
* the verb.
|
|
379
|
+
*/
|
|
380
|
+
function effectsOfVerb(kind, verb) {
|
|
381
|
+
if (verb === "eval") return kind.effects ?? [];
|
|
382
|
+
const table = kind.verbEffects;
|
|
383
|
+
return table !== void 0 && Object.hasOwn(table, verb) ? table[verb] : void 0;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
371
386
|
* This function tells if an entry of the world is a kind.
|
|
372
387
|
*
|
|
373
388
|
* @param entry - The entry.
|
|
@@ -546,6 +561,10 @@ const STD_DOMAINS = {
|
|
|
546
561
|
is: (value) => value === null,
|
|
547
562
|
summary: "The value null."
|
|
548
563
|
},
|
|
564
|
+
undefined: {
|
|
565
|
+
is: (value) => value === void 0,
|
|
566
|
+
summary: "The value undefined. A document holds it as the extension ext.undefined."
|
|
567
|
+
},
|
|
549
568
|
bool: {
|
|
550
569
|
is: (value) => typeof value === "boolean",
|
|
551
570
|
summary: "A truth value: true or false."
|
|
@@ -3574,7 +3593,7 @@ function compileNode(c, value, place, declared, depth, address = false) {
|
|
|
3574
3593
|
} catch (error) {
|
|
3575
3594
|
return failingWith(c, meta, placed(thrown(error, `the evaluator ${name}`), place));
|
|
3576
3595
|
}
|
|
3577
|
-
const done = finish$1(c, meta, placedCode(inner, place, name), void 0);
|
|
3596
|
+
const done = finish$1(c, meta, TOTAL.has(inner) ? inner : placedCode(inner, place, name), void 0);
|
|
3578
3597
|
if (frees === void 0 || kind === void 0 || !pureCode(c, envelope, kind, typePath, name, quick)) return done;
|
|
3579
3598
|
const free = freeOf(doc, kind, split.parts, frees);
|
|
3580
3599
|
if (free === void 0) return done;
|
|
@@ -3808,6 +3827,22 @@ function copyPlain(value, memo) {
|
|
|
3808
3827
|
return out;
|
|
3809
3828
|
}
|
|
3810
3829
|
/**
|
|
3830
|
+
* The compiled code that cannot fail (PLAN.TOTAL). Such code gives a value and throws nothing. It does not read its
|
|
3831
|
+
* context or its runtime. Only the kits of the kernel mark code, thus the code of a host always gets its grant.
|
|
3832
|
+
*/
|
|
3833
|
+
const TOTAL = /* @__PURE__ */ new WeakSet();
|
|
3834
|
+
/**
|
|
3835
|
+
* This function marks compiled code that cannot fail (PLAN.TOTAL). Then `compileNode` does not wrap the code in
|
|
3836
|
+
* `placedCode`, thus a literal costs one call. The kits of the kernel use it. The package does not export it.
|
|
3837
|
+
*
|
|
3838
|
+
* @param code - The code. It gives a value and throws nothing. It does not read its context or its runtime.
|
|
3839
|
+
* @returns The same code.
|
|
3840
|
+
*/
|
|
3841
|
+
function totalCode(code) {
|
|
3842
|
+
TOTAL.add(code);
|
|
3843
|
+
return code;
|
|
3844
|
+
}
|
|
3845
|
+
/**
|
|
3811
3846
|
* This function gives the code of a document: the code of its evaluator, with the place of each error and of each
|
|
3812
3847
|
* exception. The code gets the context that its grant permits, thus a compiled parent cannot widen it (CAP.NARROW-CODE).
|
|
3813
3848
|
*/
|
|
@@ -5760,16 +5795,27 @@ const EACH$2 = /* @__PURE__ */ Object.freeze([[]]);
|
|
|
5760
5795
|
/** No declared effect. One list serves each visit without effects. */
|
|
5761
5796
|
const NO_EFFECTS = /* @__PURE__ */ Object.freeze([]);
|
|
5762
5797
|
/**
|
|
5763
|
-
* This function gives the effects that the contract of the kind of a visit declares, as keys
|
|
5764
|
-
* text `"type"` gives the type of the document after each alias. A visit without a
|
|
5765
|
-
* `factsOf` and `effectsOf` read the declarations with this one function (D27).
|
|
5798
|
+
* This function gives the effects that the contract of the kind of a visit declares for a verb, as keys
|
|
5799
|
+
* (FACTS.EFFECTS, VERB.EFFECTS). The text `"type"` gives the type of the document after each alias. A visit without a
|
|
5800
|
+
* kind declares no effect. `check`, `factsOf` and `effectsOf` read the declarations with this one function (D27).
|
|
5766
5801
|
*
|
|
5767
5802
|
* @param v - The visit.
|
|
5803
|
+
* @param verb - The verb. The default is `eval`. A kind without a declaration for the verb gives no effect.
|
|
5768
5804
|
* @returns The keys of each declared effect, in the order of the contract.
|
|
5769
5805
|
*/
|
|
5770
|
-
function declaredEffects(v) {
|
|
5771
|
-
|
|
5772
|
-
|
|
5806
|
+
function declaredEffects(v, verb = "eval") {
|
|
5807
|
+
return verbDeclared(v, verb) ?? NO_EFFECTS;
|
|
5808
|
+
}
|
|
5809
|
+
/**
|
|
5810
|
+
* This function gives the effects that the contract of the kind of a visit declares for a verb, as keys. The result
|
|
5811
|
+
* is `undefined` when the contract has no declaration for the verb (D49). A visit without a kind declares no effect
|
|
5812
|
+
* for `eval` and no declaration for another verb.
|
|
5813
|
+
*/
|
|
5814
|
+
function verbDeclared(v, verb) {
|
|
5815
|
+
if (v.kind === void 0) return verb === "eval" ? NO_EFFECTS : void 0;
|
|
5816
|
+
const effects = effectsOfVerb(v.kind, verb);
|
|
5817
|
+
if (effects === void 0) return void 0;
|
|
5818
|
+
if (effects.length === 0) return NO_EFFECTS;
|
|
5773
5819
|
return effects === "type" ? [v.typePath ?? []] : effects.map((kind) => kind.split("."));
|
|
5774
5820
|
}
|
|
5775
5821
|
/**
|
|
@@ -5820,7 +5866,9 @@ function capReason(v, kind, allowed) {
|
|
|
5820
5866
|
* A run does not always fail there, thus a type issue is a static finding, not an error of a run.
|
|
5821
5867
|
*
|
|
5822
5868
|
* The check asks the ladder for the verb of the options, `eval` by default (VERB.CHECK). The shapes, the paths and the
|
|
5823
|
-
* names follow the contracts, thus they are the same for each verb.
|
|
5869
|
+
* names follow the contracts, thus they are the same for each verb. The check tests the effects that each contract
|
|
5870
|
+
* declares for the verb: `effects` for `eval`, and the entry of `verbEffects` for another verb (VERB.EFFECTS). A kind
|
|
5871
|
+
* without a declaration for the verb gives no `#CAP!` and no `#CALC!` for an effect.
|
|
5824
5872
|
*
|
|
5825
5873
|
* @param machine - The world and the code of the evaluators.
|
|
5826
5874
|
* @param doc - The document, as JSON.
|
|
@@ -6001,7 +6049,6 @@ function checkAll(machine, doc, options, nodes, seen = /* @__PURE__ */ new Set()
|
|
|
6001
6049
|
issues.push(issue);
|
|
6002
6050
|
if (current !== void 0) current.marked = true;
|
|
6003
6051
|
};
|
|
6004
|
-
const effects = verb === "eval";
|
|
6005
6052
|
const allowed = options.caps === void 0 ? void 0 : permitsOf(machine);
|
|
6006
6053
|
const waits = options.run === true ? /* @__PURE__ */ new Map() : void 0;
|
|
6007
6054
|
const drives = [];
|
|
@@ -6072,7 +6119,8 @@ function checkAll(machine, doc, options, nodes, seen = /* @__PURE__ */ new Set()
|
|
|
6072
6119
|
});
|
|
6073
6120
|
}
|
|
6074
6121
|
const caps = v.caps;
|
|
6075
|
-
const
|
|
6122
|
+
const stated = verbDeclared(v, verb);
|
|
6123
|
+
const declared = stated ?? NO_EFFECTS;
|
|
6076
6124
|
if (allowed !== void 0 && caps !== void 0) {
|
|
6077
6125
|
for (const kind of declared) if (!allowed(caps, kind)) push({
|
|
6078
6126
|
code: "#CAP!",
|
|
@@ -6094,14 +6142,14 @@ function checkAll(machine, doc, options, nodes, seen = /* @__PURE__ */ new Set()
|
|
|
6094
6142
|
},
|
|
6095
6143
|
index: issues.length,
|
|
6096
6144
|
node: current,
|
|
6097
|
-
wait:
|
|
6145
|
+
wait: false
|
|
6098
6146
|
};
|
|
6099
6147
|
drives.push(chain);
|
|
6100
6148
|
} else if (runner) chain = up ?? true;
|
|
6101
6149
|
waits.set(v, chain);
|
|
6102
6150
|
if (typeof chain === "object" && !chain.wait) {
|
|
6103
6151
|
const rule = allowed ?? permits;
|
|
6104
|
-
chain.wait = declared.some((kind) => caps === void 0 || rule(caps, kind));
|
|
6152
|
+
chain.wait = stated === void 0 || declared.some((kind) => caps === void 0 || rule(caps, kind));
|
|
6105
6153
|
}
|
|
6106
6154
|
const first = declared[0];
|
|
6107
6155
|
if (!runner && first !== void 0) push({
|
|
@@ -6853,9 +6901,13 @@ function formulaKinds() {
|
|
|
6853
6901
|
}
|
|
6854
6902
|
};
|
|
6855
6903
|
}
|
|
6856
|
-
/**
|
|
6904
|
+
/**
|
|
6905
|
+
* This function gives the type of a value of a profile: the value itself as `one`. `undefined` gives the base type
|
|
6906
|
+
* `undefined`, because JSON and thus `one` cannot hold it (D48). A function gives `unknown`.
|
|
6907
|
+
*/
|
|
6857
6908
|
function valueType(value) {
|
|
6858
|
-
|
|
6909
|
+
if (value === void 0) return "undefined";
|
|
6910
|
+
return typeof value === "function" ? "unknown" : { one: [value] };
|
|
6859
6911
|
}
|
|
6860
6912
|
/** This function tells if a value has the form of a signature: a record with `params` as a list, and `to`. */
|
|
6861
6913
|
function isSignature(value) {
|
|
@@ -6875,14 +6927,14 @@ function listText(names) {
|
|
|
6875
6927
|
return names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
6876
6928
|
}
|
|
6877
6929
|
/**
|
|
6878
|
-
* This function tells if a signature takes a count of arguments. A parameter
|
|
6879
|
-
*
|
|
6930
|
+
* This function tells if a signature takes a count of arguments. A parameter at the end is optional when its type
|
|
6931
|
+
* holds `undefined`, because a missing argument is `undefined`. `unknown` and the base type `undefined` hold it.
|
|
6880
6932
|
*
|
|
6881
6933
|
* @returns `undefined` when the number is correct, or else the text of the numbers that the signature takes.
|
|
6882
6934
|
*/
|
|
6883
6935
|
function arityOf(sig, count, domains) {
|
|
6884
6936
|
let least = sig.params.length;
|
|
6885
|
-
while (least > 0 &&
|
|
6937
|
+
while (least > 0 && member(void 0, sig.params[least - 1], domains)) least -= 1;
|
|
6886
6938
|
const most = sig.rest === void 0 ? sig.params.length : Number.POSITIVE_INFINITY;
|
|
6887
6939
|
if (count >= least && count <= most) return void 0;
|
|
6888
6940
|
if (most === Number.POSITIVE_INFINITY) return `at least ${argumentsText(least)}`;
|
|
@@ -7140,6 +7192,7 @@ function formulaTypes(profile) {
|
|
|
7140
7192
|
"formula.ext": { synth: (input) => {
|
|
7141
7193
|
const name = nameOf(input);
|
|
7142
7194
|
if (profile.ext !== void 0 && Object.hasOwn(profile.ext, name)) return "unknown";
|
|
7195
|
+
if (name === "undefined") return "undefined";
|
|
7143
7196
|
if (name === "number") return "number";
|
|
7144
7197
|
return name === "domain" ? domainTypeOf(input.doc.value, input.machine.domains) : "unknown";
|
|
7145
7198
|
} }
|
|
@@ -7186,6 +7239,7 @@ const PROFILE_KEYS = /* @__PURE__ */ Object.freeze([
|
|
|
7186
7239
|
"check",
|
|
7187
7240
|
"combine",
|
|
7188
7241
|
"pure",
|
|
7242
|
+
"pureExt",
|
|
7189
7243
|
"volatile",
|
|
7190
7244
|
"sigs"
|
|
7191
7245
|
]);
|
|
@@ -7326,7 +7380,7 @@ function formulaCode(profile) {
|
|
|
7326
7380
|
return {
|
|
7327
7381
|
"formula.lit": compiled(({ doc }) => {
|
|
7328
7382
|
const result = ok(doc.value);
|
|
7329
|
-
return () => result;
|
|
7383
|
+
return totalCode(() => result);
|
|
7330
7384
|
}),
|
|
7331
7385
|
"formula.ref": compiled(({ doc, parts, fill, address, machine }) => {
|
|
7332
7386
|
const path = doc.value;
|
|
@@ -7341,7 +7395,7 @@ function formulaCode(profile) {
|
|
|
7341
7395
|
"formula.step": compiled(({ doc, parts, fill }) => {
|
|
7342
7396
|
if (parts.length === 0) {
|
|
7343
7397
|
const same = ok(doc);
|
|
7344
|
-
return () => same;
|
|
7398
|
+
return totalCode(() => same);
|
|
7345
7399
|
}
|
|
7346
7400
|
return (ctx, rt) => {
|
|
7347
7401
|
const values = valuesOf(parts, ctx, rt);
|
|
@@ -7600,9 +7654,12 @@ function makeKnown(profile) {
|
|
|
7600
7654
|
return hasExt(name) ? true : `The language has no extension ${name}.`;
|
|
7601
7655
|
};
|
|
7602
7656
|
}
|
|
7603
|
-
/**
|
|
7657
|
+
/**
|
|
7658
|
+
* The facts of an extension of the profile that `pureExt` does not name. It gets the context, thus it can read outside
|
|
7659
|
+
* `resolve`.
|
|
7660
|
+
*/
|
|
7604
7661
|
const NOT_PURE = /* @__PURE__ */ Object.freeze({ pure: false });
|
|
7605
|
-
/** The facts of a standard extension. */
|
|
7662
|
+
/** The facts of a standard extension, and of an extension that `pureExt` names. */
|
|
7606
7663
|
const PURE = /* @__PURE__ */ Object.freeze({ pure: true });
|
|
7607
7664
|
/** The lazy rule of a lazy operation: it covers each argument. */
|
|
7608
7665
|
const EACH_PART = /* @__PURE__ */ Object.freeze([/* @__PURE__ */ Object.freeze({})]);
|
|
@@ -7612,7 +7669,8 @@ const EACH_PART = /* @__PURE__ */ Object.freeze([/* @__PURE__ */ Object.freeze({
|
|
|
7612
7669
|
*
|
|
7613
7670
|
* - An operation of `lazy` has a lazy rule for each argument.
|
|
7614
7671
|
* - An operation is pure when the profile names it in `pure`, or when `pure` is `true`. A volatile operation is not pure.
|
|
7615
|
-
* - A standard extension is pure. An extension of the profile
|
|
7672
|
+
* - A standard extension is pure. An extension of the profile is pure only when the profile names it in `pureExt` (D47).
|
|
7673
|
+
* Such an extension keeps C4: it reads the context only through `resolve`.
|
|
7616
7674
|
*
|
|
7617
7675
|
* Equal profiles give the same hook (D46).
|
|
7618
7676
|
*
|
|
@@ -7626,10 +7684,14 @@ function formulaFacts(profile = {}) {
|
|
|
7626
7684
|
function makeFacts(profile, known) {
|
|
7627
7685
|
const volatile = new Set(profile.volatile ?? []);
|
|
7628
7686
|
const pure = profile.pure === true ? void 0 : new Set(profile.pure ?? []);
|
|
7687
|
+
const pureExt = new Set(profile.pureExt ?? []);
|
|
7629
7688
|
return (path, code) => {
|
|
7630
7689
|
if (code !== "formula.op" && code !== "formula.ext") return void 0;
|
|
7631
7690
|
const name = path.slice(1).join(".");
|
|
7632
|
-
if (code === "formula.ext")
|
|
7691
|
+
if (code === "formula.ext") {
|
|
7692
|
+
if (profile.ext !== void 0 && Object.hasOwn(profile.ext, name)) return pureExt.has(name) ? PURE : NOT_PURE;
|
|
7693
|
+
return Object.hasOwn(STD_EXT, name) ? PURE : void 0;
|
|
7694
|
+
}
|
|
7633
7695
|
if (known(path, code) !== true) return void 0;
|
|
7634
7696
|
const isVolatile = volatile.has(name);
|
|
7635
7697
|
const lazy = profile.lazy !== void 0 && Object.hasOwn(profile.lazy, name);
|
|
@@ -9572,9 +9634,10 @@ function generate(world, options) {
|
|
|
9572
9634
|
const keys = options.keys ?? KEYS;
|
|
9573
9635
|
const steps = options.steps ?? 2;
|
|
9574
9636
|
const roots = options.roots ?? ROOTS;
|
|
9637
|
+
const defaultStep = Object.hasOwn(world.defaults, "step");
|
|
9575
9638
|
const stepTypes = types.filter((type) => {
|
|
9576
9639
|
const found = lookupKind(world, type);
|
|
9577
|
-
return found.ok && Object.hasOwn(found.kind.verbs, "step");
|
|
9640
|
+
return found.ok && (defaultStep || Object.hasOwn(found.kind.verbs, "step"));
|
|
9578
9641
|
});
|
|
9579
9642
|
const unknownNames = Object.keys(world.kinds).filter((key) => {
|
|
9580
9643
|
const entry = world.kinds[key];
|
|
@@ -9641,7 +9704,10 @@ function generate(world, options) {
|
|
|
9641
9704
|
if (options.own !== void 0 && options.own.length > 0 && rng.chance(.03)) out["own"] = { eval: rng.pick(options.own) };
|
|
9642
9705
|
return out;
|
|
9643
9706
|
};
|
|
9644
|
-
/**
|
|
9707
|
+
/**
|
|
9708
|
+
* A path from a root (D10). It uses the names in scope, and sometimes a step document. The kind of a step document
|
|
9709
|
+
* has the verb `step`, or the default of the world for `step` serves it.
|
|
9710
|
+
*/
|
|
9645
9711
|
const pathFor = (pos, refKind) => {
|
|
9646
9712
|
if (rng.chance(malformed)) return rng.pick([
|
|
9647
9713
|
"names",
|
|
@@ -10252,13 +10318,15 @@ function typesNaming(world, name, verb) {
|
|
|
10252
10318
|
/** This function gives the facts of the kind of a type. The hook `facts` of the machine wins over the contract. */
|
|
10253
10319
|
function contractOf(env, kind, typePath, caps) {
|
|
10254
10320
|
const facts = env.machine.facts?.(typePath, env.name);
|
|
10255
|
-
const
|
|
10321
|
+
const own = effectsOfVerb(kind, env.verb);
|
|
10322
|
+
const effects = own ?? kind.effects;
|
|
10256
10323
|
const declared = effects === void 0 ? [] : effects === "type" ? [typePath] : effects;
|
|
10257
10324
|
return {
|
|
10258
10325
|
declared,
|
|
10259
10326
|
pure: (facts?.pure ?? kind.pure) === true,
|
|
10260
10327
|
lazy: facts?.lazy ?? kind.lazy,
|
|
10261
10328
|
describes: env.verb === "eval",
|
|
10329
|
+
declares: own !== void 0,
|
|
10262
10330
|
caps: caps ?? [...declared, "probe"]
|
|
10263
10331
|
};
|
|
10264
10332
|
}
|
|
@@ -10654,8 +10722,10 @@ function checkShot(env, sample, contract, scenario, shot) {
|
|
|
10654
10722
|
const keyOf = (part) => shot.keys[part] ?? String(part);
|
|
10655
10723
|
for (const call of shot.calls) if (!call.context.caps.every((cap) => permits(docCaps, cap))) report(env, "C1", `The code gives the part ${keyOf(call.part)} ${capsText(call.context.caps)}, and its document has ${capsText(docCaps)}.`, probe);
|
|
10656
10724
|
for (const effect of shot.caused) if (!effect.context.caps.every((cap) => permits(docCaps, cap))) report(env, "C1", `The code gives its effect ${effect.kind} ${capsText(effect.context.caps)}, and its document has ${capsText(docCaps)}.`, probe);
|
|
10725
|
+
if (contract.declares) {
|
|
10726
|
+
for (const effect of shot.caused) if (!permits(contract.declared, effect.kind)) report(env, "C2", `The code causes the effect ${effect.kind}, and the contract of ${sample.type} declares ${contract.declared.length === 0 ? "no effects" : capsText(contract.declared)}${env.verb === "eval" ? "" : ` for the verb ${env.verb}`}.`, probe);
|
|
10727
|
+
}
|
|
10657
10728
|
if (contract.describes) {
|
|
10658
|
-
for (const effect of shot.caused) if (!permits(contract.declared, effect.kind)) report(env, "C2", `The code causes the effect ${effect.kind}, and the contract of ${sample.type} declares ${contract.declared.length === 0 ? "no effects" : capsText(contract.declared)}.`, probe);
|
|
10659
10729
|
const first = shot.caused[0];
|
|
10660
10730
|
if (contract.pure && first !== void 0) report(env, "C4", `The kind ${sample.type} is pure, and the code causes the effect ${first.kind}.`, probe);
|
|
10661
10731
|
if (shot.result.ok) sample.split.parts.forEach((_slot, index) => {
|
|
@@ -12032,6 +12102,7 @@ function samplesAt(values, closed, depth) {
|
|
|
12032
12102
|
const records = [];
|
|
12033
12103
|
let lists = false;
|
|
12034
12104
|
for (const value of values) if (value === null) bases.add("null");
|
|
12105
|
+
else if (value === void 0) bases.add("undefined");
|
|
12035
12106
|
else if (typeof value === "boolean") bases.add("bool");
|
|
12036
12107
|
else if (typeof value === "number") bases.add("number");
|
|
12037
12108
|
else if (typeof value === "string") bases.add("text");
|
|
@@ -12042,6 +12113,7 @@ function samplesAt(values, closed, depth) {
|
|
|
12042
12113
|
else return "unknown";
|
|
12043
12114
|
for (const base of [
|
|
12044
12115
|
"null",
|
|
12116
|
+
"undefined",
|
|
12045
12117
|
"bool",
|
|
12046
12118
|
"number",
|
|
12047
12119
|
"text"
|
|
@@ -12069,7 +12141,7 @@ function samplesAt(values, closed, depth) {
|
|
|
12069
12141
|
* This function infers a value type from sample values (TYPE.SAMPLES), as a type provider of F# does. A host uses it
|
|
12070
12142
|
* for the type of a root, for example from some events.
|
|
12071
12143
|
*
|
|
12072
|
-
* - `null`, a truth value, a number and a text give their base types, not their values.
|
|
12144
|
+
* - `null`, `undefined`, a truth value, a number and a text give their base types, not their values.
|
|
12073
12145
|
* - The items of each list join into one type of items.
|
|
12074
12146
|
* - All records join into one record with each key of the samples. A key that a record does not have is optional.
|
|
12075
12147
|
* - Values of different forms give a union, as `join` gives. No samples give `never`.
|
|
@@ -12086,6 +12158,6 @@ function typeFromSamples(values, options = {}) {
|
|
|
12086
12158
|
return samplesAt(values, options.closed === true, 0);
|
|
12087
12159
|
}
|
|
12088
12160
|
//#endregion
|
|
12089
|
-
export { ATTRIBUTE_RUNGS, CAPS_TYPE, CONSTRUCTS, ENVELOPE_KEYS, Failure, Held, JOURNAL, MergeError, PARTS, PART_INFO, ROOTS, RUNGS, STD_CAPS, STD_DEFINITIONS, STD_DOMAINS, STD_EVALUATORS, STD_EXT, STD_MACHINE, STD_RUNNERS, STD_SYNTAX, STD_WALKERS, STD_WORLD, THING, agree, ask, attributeTrace, capKeys, check, checkLatent, checkSteps, checkWorld, classify, components, conforms, context, cycles, dataEdges, decodeDomain, decodeValue, derefStep, describe, docEquals, durable, edgesOf, effectEdges, effectsOf, encodeValue, entriesAsJson, equationType, evaluate, extendDomain, factsOf, fail, failures, field, fits, flatten, formulaDefinitions, formulaEvaluators, formulaFacts, formulaKinds, formulaKnown, formulaMachine, fromJson, generate, heights, intersectCaps, isAlias, isAllowedOrder, isClosure, isEnvelope, isHostThing, isKey, isKind, isNamespace, isRecord, isRef, isStackOverflow, isTypeRef, join, jsTruthy, kindDocument, kindNamed, kindOf, layers, looksLikeKind, lookupKind, makeContext, mapRefs, member, mergeMachines, mergeWorlds, narrow, nearestWalker, necessary, nodeAt, nodeLayers, ok, parse, partCaps, partsOf, pathMatches, permits, placed, planner, prepare, print, random, recorder, ref, reference, refsOf, replayer, resolve, restrictMachine, restrictWorld, run, sameResult, sameValue, schedule, splitParts, stored, syntaxFormat, tag, thrown, toJson, typeCheck, typeFromSamples, typeFromSchema, typeIssues, typeName, typePath, typeText, typed, typesOf, valueOfThing, verifyReads, walk, worldThing };
|
|
12161
|
+
export { ATTRIBUTE_RUNGS, CAPS_TYPE, CONSTRUCTS, ENVELOPE_KEYS, Failure, Held, JOURNAL, MergeError, PARTS, PART_INFO, ROOTS, RUNGS, STD_CAPS, STD_DEFINITIONS, STD_DOMAINS, STD_EVALUATORS, STD_EXT, STD_MACHINE, STD_RUNNERS, STD_SYNTAX, STD_WALKERS, STD_WORLD, THING, agree, ask, attributeTrace, capKeys, check, checkLatent, checkSteps, checkWorld, classify, components, conforms, context, cycles, dataEdges, decodeDomain, decodeValue, derefStep, describe, docEquals, durable, edgesOf, effectEdges, effectsOf, effectsOfVerb, encodeValue, entriesAsJson, equationType, evaluate, extendDomain, factsOf, fail, failures, field, fits, flatten, formulaDefinitions, formulaEvaluators, formulaFacts, formulaKinds, formulaKnown, formulaMachine, fromJson, generate, heights, intersectCaps, isAlias, isAllowedOrder, isClosure, isEnvelope, isHostThing, isKey, isKind, isNamespace, isRecord, isRef, isStackOverflow, isTypeRef, join, jsTruthy, kindDocument, kindNamed, kindOf, layers, looksLikeKind, lookupKind, makeContext, mapRefs, member, mergeMachines, mergeWorlds, narrow, nearestWalker, necessary, nodeAt, nodeLayers, ok, parse, partCaps, partsOf, pathMatches, permits, placed, planner, prepare, print, random, recorder, ref, reference, refsOf, replayer, resolve, restrictMachine, restrictWorld, run, sameResult, sameValue, schedule, splitParts, stored, syntaxFormat, tag, thrown, toJson, typeCheck, typeFromSamples, typeFromSchema, typeIssues, typeName, typePath, typeText, typed, typesOf, valueOfThing, verifyReads, walk, worldThing };
|
|
12090
12162
|
|
|
12091
12163
|
//# sourceMappingURL=index.js.map
|