Metakit / API
@doeixd/metakit
MetaKit — an Env-indexed calculus of inspectable expressions and
single-step transitions over Effect Schema.
Built on a closed set of 50 primitive operators (Node.CoreOpId): Bool,
Eq, Null, Ord, Num, Str and Arr, with derived helpers (min,
max, abs, clamp, between, isNotNull, implies) that need no
tier implementation of their own, and one node kind, Rows, that asks a
question of each element of a list (Arr.any, Arr.sum, …).
Namespaces
addWrites | Two adds commute where num.add is commutative and associative, over the integers it is associative over. |
Arr | Lists: their length (arr.count, arr.isEmpty), what a write makes of one (arr.append, and arr.include and arr.exclude over a set held as a sorted list of… |
Bool | Boolean primitive operators (bool.and, bool.or, bool.not), three-valued the way SQL's are: false AND null is false, true AND null is null. A refused operand… |
combineWrites | Two combines commute where both name one operation claiming commutative and total associative. |
Eq | Equality and set-membership primitive operators: eq.is and eq.in, and SQL's = and in (eq.equals, eq.among); isNot is not(is(…)). |
Expr | Inspectable, pure, terminating expressions indexed by a typed environment Env (Expr<Env, A>). |
foldProperties | |
folds | Every fold by its id: for a reader that rebuilds a node from its id alone (the codec). |
Node | The seven kinds of node every MetaKit expression is made of, and the closed set of 50 primitive operators (CoreOpId). |
Null | Nullability primitives (null.isNull, null.coalesce) and derived helper (Null.isNotNull). |
Num | Numeric arithmetic primitives (num.add, num.sub, num.mul, num.neg) and derived helpers (min, max, abs, clamp) built over If + Ord. |
Ord | Ordering primitives (ord.lt, ord.lte, ord.gt, ord.gte) and derived range helper (Ord.between). Null-strict: a comparison with null is null. NaN has no… |
Path | Typed, serializable paths into an environment (Path<Env, A>). |
Sets | Set operations over scalar sets (held as arrays of finite numbers or NUL-free strings): union, intersect, difference (core primitives) plus derived helpers… |
setWrites | The rows of set and add, exported apart: a page that asks only of these two (foldkit-remote's replay) keeps them and drops the rest of the table. |
Str | String primitives (str.len, str.startsWith, str.contains, str.lowerAscii, str.trim, the code-point orders str.lt, str.lte, str.gt, str.gte) and derived… |
Time | Calendar-day time operations (time.*): addDays, addMonths (clamped to month-end), daysBetween, startOfMonth, and half-open overlaps. |
Transition | Guarded, single-step state transitions (Transition<State, Input, Emit, Supplied>). |
Verdict | A reader's answer to "does it hold", for a reader that does not run the term. A predicate holds only where it evaluates to true. |
writeProperties |
Functions
foldPropertiesOf | The properties of a Rows fold, deriving a reduce fold's row from its operation under options (reduceProperties). |
reduceProperties | Derive 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.… |
Values
Interfaces
Expression | Pure, terminating expression reading paths from Env and producing A. Env is contravariant (phantom) so an expression over { row } widens into { row,… |
FoldProperties | What a fold keeps, as it is read off the elements' answers. |
OpProperties | The closed set of seven properties, each an optional field, and two rewrite rules partial evaluation alone reads (reflexive, involution). |
TransitionDef | A guarded, single-step transition over State, Input and the Supplied values. InputServices bounds the services decoding or encoding its input Schema needs:… |
WriteProperties |
Types
CommuteCondition | When two writes to one path give one state in either order: |
Direction | Per argument: a larger value never gives a smaller answer (up), or never a larger one (down). |
Domain | The values a property holds over: every value evaluation can meet, or the safe integers (with null and a refusal). Addition of doubles rounds, so grouping… |
EnvOf | Map { k: Schema } to { readonly [K]: Schema['Type'] }. |
IdempotentCondition | When a write of one way, run twice in a row with the same values, leaves what it left once: |
NoSupplied | A transition that takes no supplied input. |
PathAccessor | Recursive typed accessor for an environment value A: every plain object property (including TypeScript interfaces) becomes a nested PathAccessor<Env, A[K]>,… |
SchemaOf | Constraint for a generic helper that both composes a Schema (Schema.Struct, Schema.Array, Expr.refine) and decodes it synchronously (Schema.decodeUnknownSync). |
Side | Which argument a value stands in: the first, the second, or either. |
WayOfWriting | How a transition changes one path. |