Package Management & `pond` Catalog

Hale's built-in standard library (std::*) covers core I/O, networking, HTTP, JSON, cryptography, logging, metrics, and the message bus. Ecosystem…

Hale’s built-in standard library (std::*) covers core I/O, networking, HTTP, JSON, cryptography, logging, metrics, and the message bus. Ecosystem libraries—database drivers, migrations, NATS adapters, WebSockets, TUI frameworks, and LLM agent toolkits—live in pond, the official contributed library repository.


1. Vendoring Dependencies (hale.toml & hale fetch)

Section titled “1. Vendoring Dependencies (hale.toml & hale fetch)”

Declare git dependencies in hale.toml pinned to a commit SHA:

[deps]
pond = { git = "https://github.com/hale-lang/pond", rev = "<commit-sha>" }

Run hale fetch to clone each dependency into vendor/<name>/ and record the exact commit in hale.lock:

Terminal window
hale fetch

2. Importing Libraries (import ... as ...;)

Section titled “2. Importing Libraries (import ... as ...;)”

Import a vendored or local seed directory using import "<path>" as <alias>;:

import "vendor/pond/sqlite" as sqlite;
main locus App {
run() {
let db = sqlite::Db { path: "app.db" };
}
}

Bringing names in bare: import lists

Section titled “Bringing names in bare: import lists”

An import may end in a list of names. Each listed name is spelled bare in your seed, in every file of it, and as renames one:

import "../store" as st { ModelRow, Side, describe as show };
fn label(r: ModelRow) -> String {
return show(r);
}
fn buying() -> Side {
return Side::Buy;
}

st::ModelRow keeps working beside the bare ModelRow; they are one declaration. A list names types (records, enums, aliases), loci, fns, consts, topics and interfaces; there is no glob.

A list re-exports. What a seed lists is reachable through that seed’s alias by its own importers. If api lists ModelRow from st, an importer of api can write api::ModelRow, or list it again (import "../api" as api { ModelRow };), and it is the same type as st::ModelRow — a value moves between the spellings with no conversion. Moving a type from one seed to another is then a change to an import list rather than to every use.

The compiler refuses, at the item:

A local variable or parameter of the same name shadows a listed name, as it shadows any top-level name.

Resolution & Scoping Rules

Section titled “Resolution & Scoping Rules”
Rule Behavior
Check/build the directory, not a single file In a multi-file seed, run hale check . or hale build .. Checking a single file (hale check other.hl) compiles that file standalone without sibling files’ import declarations.
Directory vs. file imports import "../lib" as lib; and import "../lib/main" as lib; both import the entire ../lib/ seed directory as one library. Importing any other .hl file (import "../lib/helper" as h;) imports that single file standalone. You cannot import both a directory and an individual file inside that same directory in one program.
A seed never imports its own files The files of one directory share one scope, so a sibling’s declarations are already yours by their bare names: call double(2), not util::double(2). import "util" as util; (or "./util", or ".") naming a file of the seed being built, or its own directory, is refused at the import. A single-file target (hale run main.hl) is a seed of that one file, so there a sibling util.hl is imported as a library of its own.
Aliases are seed-local namespaces An import alias (sqlite::Db) is a namespace, not a value binding: a function named fn core() and import "../core" as core; do not collide (core::fn_name() vs core()). However, keep aliases snake_case so they never collide with PascalCase type or enum names (Type::Variant takes precedence over alias::Symbol).
Qualified names check like bare ones A library’s generic type or enum named through its alias is checked against its declaration exactly as a local one is: lib::Box<Int, String> against type Box<T> is a type error for its argument count, and lib::Side::Limit("x") for its payload type. A scale-less Decimal literal in a lib::Side::Limit(1.25d) payload takes the declared scale.
Type identity across aliases Importing the same library under two aliases (a and b) refers to the exact same underlying types (a::Row is type-compatible with b::Row). A name re-exported through an import list (api::Row) is the same type too.
Aliases are not re-exported A library’s own import aliases stay inside it: when api imports "../store" as st, its importers cannot write api::st::Row or st::Row without importing the store themselves. Only the names api lists on that import are reachable as api::Name.
Imported main locus is inert If an imported library directory contains its own main locus and fn main(), importing that library does not activate its main locus, bindings, or placement. Your application can still declare its own main locus.
Stdlib requires std:: Built-in standard library modules are called directly via std::* (e.g., std::env::args_count(), std::time::sleep(1s)) with no import statement. Omitting std:: produces a compile error suggesting the std:: prefix.

3. The pond Library Catalog

Section titled “3. The pond Library Catalog”

All libraries below are imported from vendor/pond/<path> after running hale fetch.

Persistence & Databases

Section titled “Persistence & Databases”
Import Path Description
vendor/pond/db Driver-agnostic database interface (DbDriver) and parameterized query builder (Args for $1, $2, ... placeholders).
vendor/pond/pq PostgreSQL driver (PgConn) and fixed-size connection pool (PgPool) implementing db::DbDriver. A transaction runs as a body (pq::Transaction, one method apply(tx: PgConn) -> db::Status): pool.transaction(body) holds one pooled connection from BEGIN to COMMIT (the body answered ok) or ROLLBACK (it did not, or a statement in it was refused) and releases it either way, while other operations use the rest of the pool.
vendor/pond/sqlite SQLite 3 connection and fallible query surface implementing db::DbDriver.
vendor/pond/migrations Schema migration runner (Migrator) over any db::DbDriver (up, down, steps, goto).
vendor/pond/jobs Persistent SQLite-backed job queue (Queue) and pinned worker pool (Pool, Worker).

Web, HTTP & Realtime Messaging

Section titled “Web, HTTP & Realtime Messaging”
Import Path Description
vendor/pond/sessions Stateless HMAC-signed cookie sessions (session=<base64(payload)>.<base64(hmac)>).
vendor/pond/websocket RFC 6455 WebSocket client and server upgrade handler with ping/pong liveness deadlines.
vendor/pond/realtime/nats NATS Core and JetStream client plus a std::bus transport adapter for cross-process topic delivery with at-least-once semantics.
vendor/pond/http Legacy HTTP client pool (superseded by built-in std::http).
vendor/pond/router Legacy HTTP router (superseded by built-in std::http::Router).

Observability, Supervision & OS Processes

Section titled “Observability, Supervision & OS Processes”
Import Path Description
vendor/pond/logfmt Additional std::log sinks implementing std::text::Sink, including OtlpSink (console and file sinks are built into std::log).
vendor/pond/tracing Hierarchical span tracer (Tracer) that automatically mirrors the locus ownership tree.
vendor/pond/supervisor Erlang/OTP supervision strategies built on top of Hale’s on_failure (restart, restart_in_place, bubble).
vendor/pond/subprocess Child process manager wrapping std::process::run and spawn with piped stdio and timeouts.
vendor/pond/crypto Additional cryptographic helpers complementing std::crypto.
vendor/pond/metrics Legacy Prometheus metrics registry (superseded by built-in std::metrics and std::observe::Scrape).

Terminal UI, AI Agents & Scientific Computing

Section titled “Terminal UI, AI Agents & Scientific Computing”
Import Path Description
vendor/pond/term Terminal capability detection (is_tty), ANSI SGR styling, raw-mode guard, and cursor/screen control over std::term.
vendor/pond/tui Elm-architecture terminal UI runtime (model / update / view locus driven by a frame loop).
vendor/pond/agent LLM agent toolkit (agent/llm, agent/tools, agent/conversation, agent/embeddings, agent/sandbox).
vendor/pond/ml Neural network primitives (ml/neural).
vendor/pond/math Matrix algebra and statistical functions (math/matrix, math/stats).

Editor Grammar: The Tree-sitter grammar for syntax highlighting lives in its own repository at github.com/hale-lang/tree-sitter-hale.