kex docs Standard Library

Standard Library

Reference documentation for the Standard Library package, generated from source at 2026-10-07.

In the prelude

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

AtomAtoms are named values such as :ok, :error, and :reset. Use them for labels, statuses, and message tags. Atoms with the same name are equal; an atom and a string are different values. 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.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. Process.Shared TaskRunning work in another process and collecting the answer. SupervisorSupervision trees: processes that restart the processes under them when they crash. 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. UnitsTime-unit constructors, also available directly from the prelude.

Opt-in

Available after an explicit using — using FS before FS.File.read.

BitsBitwise operations on Integer. DigestCryptographic content digests. DimensionsDimension algebra, implemented with ordinary Kex maps and integers. 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 for testing HTTP, DNS, sockets and WebSockets. 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. NodeDistributed Kex: this BEAM node, and the other nodes it is connected to. OptionParser ParsingParser combinators, for reading a text format you define yourself. RandomRandom values for simulations, sampling, games, and reproducible tests. Random.Generator Regex TemplateAn ERB-shaped template scanner: template text in, a template AST out. URI URI.URL URI.Query URI.Form Control.RetryRetry an operation after it returns an error. Control.Retry.Retryrun calls the block immediately. Ok stops; Error waits and retries. When the schedule runs out, it returns the last error unchanged. Use again and done when your application needs to choose what to retry. Data.QueueConstructors for Queue. Data.SetConstructors for the sorted Set. Data.UnorderedSetConstructors for the hash-backed UnorderedSet. 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.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 connections, client- and server-side. Units.DataData sizes: bytes, kilobytes, and their binary counterparts. Units.DynamicRuntime dimensional quantities. Unit dimensions use nominal Type identities, and all arithmetic composes the same normalized exponent maps. Units.SISI units: metres, grams, watts, volts and the rest, with prefixes and dimensional arithmetic.