This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 10/5/2026.
Explain
~import std/explainexplain.kz — the `explain` COMMAND for Koru
explain.kz · 1 tors · ~[comptime]
explain.kz — the `explain` COMMAND for Koru · 15 more lines
explain.kz — the `explain` COMMAND for Koru
The SQL-`EXPLAIN` move, lifted to the compiler: a library optionally ships a
comptime *explainer* that reads the program AST and explains how the library
interpreted YOUR program's use of ITS OWN facilities — not generic docs, but
"given this config and these call sites, here is what I decided about THIS
code." Report rows carry `at` witness hashes — `koruc <file> at <hash>`
resolves them (see site_hash.zig; rendering lives in the `wit` part).
koruc main.k explain # human-readable (text)
koruc main.k explain json # machine-readable
koruc main.k explain html # rich page
The `explain` command is the ONLY caller of explainers — runs INSTEAD of
compilation on the freshly-parsed, pre-analysis AST (closest to source).
~[comptime|command] pub tor explain {
program: std/compiler:*const Program,
allocator: __koru_std.mem.Allocator,
argv: []string
}