Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Libraries (pond)

The standard library covers the substrate — I/O, time, strings, JSON, HTTP, crypto, the bus. Everything else — web stacks, databases, observability — lives in pond, the contributed library catalog: https://github.com/hale-lang/pond.

Many lotus grow in a pond. Each library is a directory of .hl loci you vendor into your project.

Using one

Declare it in hale.toml, fetch it, import it:

[deps]
pond = { git = "https://github.com/hale-lang/pond", tag = "v0.1.0" }
hale fetch
import "vendor/pond/router" as router;

hale fetch clones each dependency into vendor/<name>/ and pins the resolved commit in hale.lock. Pond’s “no transitive dependencies in v1” rule means every package your program pulls in is visible in your lockfile — if a library uses another, you vendor both explicitly.

The catalog

Persistence & data

LibraryProvides
dbDriver-agnostic database surface: the DbDriver interface + Args bind-parameter list for parameterized ($1, $2, …) queries. Pick a backend (pq, sqlite) at the DbDriver slot.
pqPostgreSQL driver — PgConn plus PgPool, a fixed-size fd connection pool that itself satisfies db::DbDriver.
sqliteSQLite connection + fallible query surface.
migrationsSchema migration runner (up/down); builds to a migrate binary.
jobsSQLite-backed job queue (Queue) + a pinned-worker pool.

Web

LibraryProvides
httpHTTP client (http/client) over std::io — request/response building atop the socket primitives, for libraries that need an HTTP client without the full std::http server surface.
routerHTTP router over std::http — method + path-param routes, middleware chain.
sessionsStateless, HMAC-signed cookie sessions (session=<base64(payload)>.<base64(hmac)>).
websocketSynchronous, owner-driven RFC 6455 WebSocket client (suggested alias ws); a passive wrapper your own run() loop drives.

Observability & supervision

LibraryProvides
logfmtAlternative std::log sinks wearing the std::text::Sink shape — file with rotation, structured output.
metricsCounter / gauge / histogram primitives + a Prometheus text-format renderer and /metrics endpoint.
tracingSpan tree mirroring the locus tower — one Tracer per app; spans nest with locus instantiation.
supervisorErlang/OTP supervision-tree strategies grafted onto Hale’s on_failure + restart / restart_in_place / bubble.

Primitives & composition

LibraryProvides
cryptoSHA-256, HMAC-SHA256, hex encode/decode, constant-time compare, CSPRNG.
subprocessSpawn + manage child processes (suggested alias sub) — wraps the std::process spawn / wait / pipe primitives.
towerRun several independent locus trees (“towers”) under one process, each with its own root and lifecycle.

Terminal & UI

LibraryProvides
termTier-0 terminal infrastructure — capability/is_tty probes, SGR styling, raw-mode guard, cursor + screen control over std::term.
tuiAn Elm-shaped TUI runtime: write a locus with model/update/view, the runtime drives the frame loop, input, and rendering.

AI & numeric

LibraryProvides
agentLLM-agent toolkit — agent/{llm, tools, conversation, embeddings, sandbox}: a client surface, a tool-registry, conversation state, and a sandboxed execution path.
mlNeural-network primitives (ml/neural).
mathNumeric helpers — math/{matrix, stats}.

heron (the tree-sitter grammar that drives editor tooling) also lives in pond, but it’s developer tooling, not a vendored runtime library you import. The _util directory holds internal helper libs consumed by other pond libs, not imported directly by apps.

Pond is where the ecosystem grows: if a protocol, parser, or shape is too useful to rewrite per project but doesn’t belong in the language, it lands here.