kex docs Standard Library 0.4.0-alpha kex.run ↗

Standard Library 0.4.0-alpha

Reference documentation for the Standard Library package, generated from source at 2026-08-31.

In the prelude

Visible in every file, with no import. 27 module(s).

Binary ConsoleANSI terminal styling: colors, text attributes, and cursor control. ENVThe process environment, as an immutable `Map<String, String>` snapshot taken at startup. FeedConstructors for `Feed`. IOConsole input and output. KexThe running toolchain, which backend, which version, which features. Kex.KernelBuild identity for the compiler and runtime executing this program. Kex.FeatureWhich optional capabilities this build includes. Kex.InterfaceReading the typed public surface of a compiled Kex module. MathMathematical constants and functions. IntegerReading integers out of text. FloatReading floating-point numbers out of text. NumberReading a number out of text without deciding in advance which half of the numeric tower it belongs to. ProcessSpawning servers, running external commands, and the ambient process operations. TaskRunning work in another process and collecting the answer. StreamConstructors for `Stream`. StringConstructors for `String` values that are built from something other than text: a Unicode codepoint, or raw UTF-8 bytes. SystemThe running process and the machine under it: exiting, and asking what platform this is. TaggedValidationDiagnostics returned by compile-time validators for tagged literals. AssertFocused assertions, each reporting what was expected and what arrived. TimeBuilding times of day, controlling the clock in tests, and the calendar arithmetic the rest of this file is written on. DateBuilding calendar dates, and asking what today is. DateTimeBuilding instants, and asking what time it is now. DurationBuilding elapsed spans, and UTC offsets. PeriodBuilding calendar spans. TypeBuilding and obtaining `Type` values. UnitsThe time units are prelude-global, because every unit module measures against the same dimensions: `Units.SI` defines `Watt * Hour` with the `Hour` declared above, and future domains do the same. That makes `Hour` correct but not obviously located, so the same constructors are reachable under `Units` too, for call sites that would rather name where a unit comes from. These are aliases, not copies: each binds the identical constructor, so `Units.Hour` and `Hour` match the same patterns and compare equal.

Opt-in

Available after an explicit usingusing FS before FS.File.read.

BitsBitwise operations on `Integer`. DigestCryptographic content digests. EvaluatorRunning Kex source code at run time, in a sandbox. FSThe filesystem: reading and writing files, walking directories, and manipulating paths. FS.FileReading and writing files. FS.PathPath arithmetic: joining, splitting, normalising and comparing paths. FS.DirectoryCreating, listing and removing directories. JSON Mock Mock.FSA stateful stand-in for the filesystem: files a test declares, that the real `FS.File` then reads back. Mock.ENVOverlays the process environment, so a test can say what `ENV` holds instead of depending on how it was launched. Mock.IOA stateful stand-in for the console: captures what a program prints, and feeds it lines as if they had been typed. Mock.NetScriptable networking values are namespaced so importing Mock does not recreate any of the removed global HTTP types. Mock.Net.HTTPCanned HTTP transport state for networking specifications. Mock.Net.DNSCanned DNS resolver state for networking specifications. Mock.Net.SocketCanned byte-stream state for socket specifications. Mock.Net.WebSocketCanned message state for WebSocket specifications. NetShared networking values, capability discovery, and typed failures. Net.PortValidated `Port` construction. Net.SupportRuntime discovery for optional network transports and protocols. OptionParser ParsingParser combinators, for reading a text format you define yourself. Regex TemplateAn ERB-shaped template scanner: template text in, a template AST out. URI URI.URL URI.Query URI.Form Control.RetryBounded retries for operations whose failures can be classified by the application. Control.Retry.RetryThe imported public namespace: `using Control.Retry` then `Retry.run(...)`. DataA first-in-first-out queue. Data.QueueConstructors for `Queue`. DataImmutable collections of distinct elements. Data.SetConstructors for the sorted `Set`. Data.UnorderedSetConstructors for the hash-backed `UnorderedSet`. DataA last-in-first-out stack. Data.StackConstructors for `Stack`. Kex.ASTParses Kex source code into a structured AST, at run time. Net.DNSTyped DNS lookup with explicit resolver ownership and bounded caching. Net.DNS.NameValidation and IDNA conversion for DNS names. Net.DNS.ResolverConstructors for long-lived, cache-owning resolvers. Net.DNS.DNSConvenience lookup operations for callers that do not need resolver ownership or cache reuse. Net.HTTPBuffered HTTP clients, responses, and a small declaration-ordered server router. Requests never follow redirects or perform generic retries implicitly. Net.HTTP.HeadersConstruction and parsing of validated HTTP header collections. Net.HTTP.StatusValidation for numeric HTTP status codes. Net.HTTP.ResponseBuffered response constructors for route handlers. Net.HTTP.RouterThe empty starting point for an immutable route declaration chain. Net.HTTP.ServerStarting, observing, and gracefully stopping HTTP servers. Net.HTTP.ClientConstructors for explicitly owned, connection-pooling HTTP clients. Net.HTTP.HTTPStateless HTTP convenience calls for scripts and occasional requests. Net.IPValidated, canonical IP addresses and CIDR networks. Net.IP.AddressStrict parsing and canonicalization of individual IP addresses. Net.IP.NetworkStrict parsing and canonicalization of CIDR networks. Net.SocketProcess-owned TCP byte streams and listeners. All blocking operations return typed `NetError` values; close operations are idempotent. Net.Socket.TCP Net.Socket.TCP.Endpoint Net.Socket.UDP Net.Socket.UDP.Endpoint Net.Socket.Unix Net.Socket.Unix.Address Net.Socket.TLS Net.HTTP.WebSocketHigh-level RFC 6455 client messages. The runtime handles fragmentation and ping/pong frames; reconnect and heartbeat policies remain application-owned. Net.HTTP.WebSocket.WebSocketConstructors for high-level WebSocket client connections. Units.DataData sizes: bytes, kilobytes, and their binary counterparts. Units.SISI units: metres, grams, watts, volts and the rest, with prefixes and dimensional arithmetic.