Skip to main content

Stdlib Index

Every module that ships with AILANG, grouped by what it's for. Pure modules can be imported anywhere; capability modules need their capability passed via --caps at run time.

ailang run --caps IO,Net,Clock examples/runnable/myprogram.ail

See Effects for how the capability system works, Modules for import syntax, and Browse Packages for third-party modules published to the registry.

Data & Collections

ModulePurposeCapability
std/listFunctional list operations: map, filter, fold, take, drop
std/arrayO(1) indexed arrays (vs lists, which are O(n) indexed)
std/mapO(1) key-value lookup backed by Go hashmaps
std/stringLength, substring, trim, split, replace, case
std/bytesUTF-8 encoding, base64, byte-level operations
std/iterFoldStep and bounded folds for early exit

Algebraic Data Types

ModulePurposeCapability
std/optionSome(x) / None for values that may not exist
std/resultOk(x) / Err(e) for operations that can fail

Numerics & Randomness

ModulePurposeCapability
std/mathTrigonometric, exponential, logarithmic, rounding
std/randRandom integers, floats, booleans (seeded)Rand

Time

ModulePurposeCapability
std/datetimePure date/time math (parsing, formatting, arithmetic)
std/clockWall-clock time and sleep; deterministic mode supportedClock
std/gameFrame timing for game loops: delta time, FPSClock

Encoding & Serialization

ModulePurposeCapability
std/jsonJSON encode/decode
std/xmlParse XML strings into XmlNode trees, query elements
std/gzipGzip compress/decompress (base64-encoded I/O)
std/zipRead/write ZIP archives (including .docx, .xlsx, .epub)
std/tarRead entries from uncompressed tar archives
std/jwtParse and verify JSON Web Tokens
std/cryptoHash, HMAC, symmetric/asymmetric primitives

I/O

ModulePurposeCapability
std/ioPrint to stdout, read from stdin, exit codes, raw bytesIO
std/fsRead/write files; sandboxed via AILANG_FS_SANDBOXFS
std/envEnvironment variable access (snapshot, allowlist, redaction)Env
std/processExecute external commands; allowlist + timeout + size limitsProcess

Network

ModulePurposeCapability
std/netHTTP GET/POST; HTTPS by default, DNS rebinding preventionNet
std/streamWebSocket (bidirectional), SSE (server-sent events)Stream

AI & Semantic

ModulePurposeCapability
std/aiGeneral-purpose AI oracle: string -> string, JSON variantsAI
std/embeddingCompute embedding vectors via host-provided modelvaries by host
std/semSemantic frame caching primitivesClock, SharedMem
std/sharedmemKey-value shared memory (effect wrappers for caching)SharedMem
std/sharedindexNamespace-partitioned similarity search indexSharedIndex
std/simhashSimHash fingerprints for near-duplicate detection

Tracing & Debug

ModulePurposeCapability
std/debugStructured tracing and assertions; erased in --release modeDebug (ghost)
std/traceEmit custom spans and events into the trace pipelineTrace
std/trace_testTest helpers for trace-based assertionsTrace

Importing modules

module myapp

import std/io (println)
import std/list (map, filter)
import std/result (Result, Ok, Err)

export func main() -> unit ! {IO} {
let xs = [1, 2, 3, 4, 5]
let evens = filter(\x. x % 2 == 0, xs)
println("evens: ${evens}")
}

Run with: ailang run --caps IO myapp.ail

See also