This chapter provides a quick-reference cheat sheet of Hale’s syntax, decorators, CLI subcommands, diagnostic formats, and links to the normative language specifications in spec/.
Declares the conversion or raise applies from its one parameter’s error type to its result’s (@raise fn conv(e: P) -> E); makes no syscall, publish, spawn or block
@hot
fn
Promotes hot-path allocation advisories inside the function to errors
@budget(alloc_per_call = N)
fn
Hard compile-time ceiling on arena allocations per call (0 = zero-alloc)
@bounded_by(input_name)
fn / hook
Documents external input bounding an allocation loop; silences unbounded-alloc advisory
Output binary location (-o / --out): By default, hale build app.hl writes ./app and hale build myapp/ writes myapp/myapp. Pass -o target/seeds/myapp/myapp to place build artifacts outside your source tree. For --target wasm32, -o path/app.wasm writes both app.wasm and app.mjs at that destination.
Flag positioning: For build, check, verify, test, and bench, flags may appear before or after the target path (hale build --dev app.hl and hale build app.hl --dev are identical). For hale run, compiler flags must appear before the target path (hale run --observe app.hl arg1 arg2), because all arguments after the target path are forwarded to the program’s argv.
Shared build flags on run and replay:hale run and hale replay accept --dev, --target-cpu, --link, and --csrc. Recording identities include these flags so that a --dev recording must be replayed with hale replay --dev. Without --target-cpu, hale replay rebuilds at the CPU the recording names, so a recording of a --target-cpu portable build replays without the flag (a build for a named CPU is replayed with that name). Report-only flags (--locality-report, --target-cache, --strict, --wrap-main, -o) apply only to hale build.
Target CPU: every verb tunes for the host CPU by default, hale build included; its built: line names the CPU. Pass --target-cpu portable for a binary whose machine is unknown (x86-64-v3 on x86-64, generic on aarch64), or --target-cpu <cpu> (an LLVM CPU name such as znver4) for a known machine elsewhere.
All commands (check, verify, build, run, test, bench, replay) follow all import edges and emit diagnostics in a uniform format using canonical, symlink-resolved absolute paths:
/abs/path/to/file.hl:line:col: <kind>: <message>
<source line>
^^^^
Backend/codegen errors: Constructs accepted by the typechecker that fail during lowering emit path:line:col: codegen error: <message>, placed at the nearest expression, statement, member or declaration being lowered; one raised inside a standard library body ends (in the standard library, <file>:<line>:<col>). A construct the compiler cannot lower yet says hale can't compile this yet: …; a positionless line is left only for a missing toolchain component or a failed link.
Standard library effect notes: When an @effects violation occurs inside a std::* body called by your code, the primary error points to your call site and attaches a note: the '<effect>' effect happens here (in the standard library, <file>:<line>:<col>).
NDJSON mode (hale check --json): Emits one JSON object per line on stdout ({"file": "...", "line": N, "col": N, "severity": "...", "kind": "...", "message": "..."}) covering parse errors, type errors, I/O errors ("kind": "io error", line: 0, col: 0), and stdlib notes (file: "", line: 0, col: 0). Empty stdout means zero findings.