Metakit / API

@doeixd/metakit/build

The kernel's functions over nodes (@doeixd/metakit/build), for a language written on metakit that builds its own constructors: foldkit-entity's Expr builds metakit nodes through these.

wrap types a node as an Expr, toNode takes an Expr or a literal to its node, and call builds a call of a core or foreign operator. evalNode, residualizeNode, judgeNode and readsOfNode are the readers Expr.evaluate, Expr.residualize, Expr.judge and Expr.reads run, over a node; settleNode is the value judgeNode decides from, for a node that is not a predicate. A second reader shares the reference's rules through normalizeRead (a read of -0 is 0), matchArm (the case a Match takes), applyForeign (a foreign call's refusals and Schema checks) and formatValue (a value in a refusal's detail); a decoder applies the builder's checks through caseProblem (a Match's case labels) and declaresNoNul (a check that refuses text holding a NUL). coreOps holds the descriptor of every core operator by id, coreArity its argument count and isCoreOpId says whether a string names one of them. Facts exposes what a reader can establish about a term, Schema or value.

Namespaces

coreArityExpected argument count for each core primitive: a new CoreOpId fails to compile until it is here.
coreOpsEvery primitive's descriptor: a new CoreOpId fails to compile until its operator is here.
Facts

Functions

applyForeignA foreign call over argument values: refused where no implementation of its id and version is given (unsupported), where the one given throws (failed), and…
attestClaimsRun each claim op declares on the tuples samples gives it, through the implementations in foreign. Evidence, at assurance tested, covers only the claims…
callBuild a core or foreign call. Throws if a core operator gets the wrong number of arguments.
caseProblemWhat is wrong with the case labels keys of a Match on on, or undefined: a label holding a NUL character (Postgres cannot store one), a label given twice, a…
declaresNoNulA check that refuses text holding a NUL: the one Text.schema makes, by its annotation.
evalNodeEvaluate node against a concrete env: a value, null, or a Node.Refusal. A foreign call runs the implementation foreign gives.
foreignArgsWithinWhether each of args is known, from its value or its Schema, to be within op's argument Schema at its position (or null): where op's total claim applies, a…
formatValueFormat an arbitrary value for a refusal, even when its conversion hooks throw.
isCoreOpIdTrue when id names a closed-set core operator.
isExprTrue when value is an Expr (including a Path).
judgeNodeJudge a boolean Node against partialEnv: True where it is known to hold, False where it is known not to (false, null, or refused, and then the refusal is…
knownVerdictWhat a guard that evaluates to value is judged: held, false, or refused as evaluation refuses it.
matchArmThe branch of match that target takes: null where there is no fallback and the target is null, a refusal where the target is text holding a NUL or no case…
normalizeRead
readSegmentsThe value at segments: null where a step is absent, and an Option read as its value or null.
readsOfNodeCollect the static read footprint of node in the environment: Option.none() means unbounded (an opaque term with no declared reads). A read of an element…
readsOfTermEvery place node reads, the reads of an element whose binder is outside node among them: Option.none() means unbounded (an opaque term with no declared reads).
reducePropertiesDerive a reduce fold's properties from its custom operation's claims. Its identity is the fold's definition (the answer over no element) and is always read.…
residualizeNodePartially evaluate node against partialEnv, substituting known paths and applying declarative size-reducing operator laws. A foreign call over known…
sameAnswerTwo answers that are one: equal values, or refusals for one reason.
settleNodeSettle node against partialEnv. A foreign call over known arguments runs the implementation foreign gives, and is open where it gives none.
toNodeConvert an ExprInput (either an Expr or a literal) to a Node.
wrapWrap a raw Node as a typed Expr<Env, A>.

Values

ClaimResultConstructors and $match for ClaimResult.
SettledWhat a partly known environment settles a node to: its value (null or a Node.Refusal among them), or, where it rests on what the environment lacks, why it…

Interfaces

ClaimSamplesArgument tuples to try for each declared claim. Every args tuple has the operation's arity.
ForeignImplementationOne implementation of a foreign operation.

Types

EnvOfInputExtract the Env required by an ExprInput (unknown for plain literals).
ExprInputEither an Expr<Env, A> or a plain literal value A.
ForeignImplementationsThe implementations a reader is given, by id@version (Node.foreignName), so two versions of one operation each have theirs.
NullOfnull where the input may be null: what a null-strict operator's result then may be.
ValueOfInputExtract the output value type of an ExprInput.