Skip to content

Standard Library

The Prove standard library is a set of 24 modules (plus aliases) that ship with the compiler. Each module is a .prv file declaring types and function signatures, backed by a C implementation that the compiler links into the final binary.


Core Concepts

Verb Families

Verbs define what a function does. The compiler enforces their guarantees:

Family Verbs Guarantees
Pure transforms, validates, derives, creates, matches No IO, no side effects. Safe to memoize, parallelize
IO inputs, outputs, dispatches, streams Reads/writes to external world
Async detached, attached, listens, renders Concurrent execution via coroutines

See Functions & Verbs for the full reference.

Channel Dispatch

Many modules organize functions by channel — the same name with different verbs:

// Three operations on "file", resolved by verb at call site
inputs file(path String) String!      // read file
outputs file(path String, content String)!  // write file
validates file(path String)           // check if exists

The caller's context determines which function is invoked. This is verb-dispatched identity — see Functions & Verbs.

Always-Available Types

These types need no import:

  • Primitives: Integer, Decimal, Float, Boolean, String, Character, Byte, Unit
  • Containers: List<Value>, Option<Value>, Result<Value, Error>, Table<Value>
  • Special: Value, Error, Source

Builtin Functions

These functions are always available without import — they are compiler builtins, not part of any stdlib module:

  • Iteration: map, filter, reduce, each, all, any — work on any iterable (List, Array)
  • Parallel: par_map, par_filter, par_reduce, par_each — parallel variants (pure functions only)
  • Utility: len

See Lambdas & Iteration for the full reference.


Module Summary

Module Status Purpose
Character Complete Character classification (alphabetic, digit, whitespace, etc.) and string-to-char access
Text Complete String operations (slice, contains, split, join, trim, replace) and StringBuilder for efficient string construction
Table Complete Hash map Table<Value> with creates new, derives get, derives add, validates has
List Complete Operations on List<Value>: length, first, last, contains, sort, reverse, range
Array Complete Fixed-size contiguous arrays Array<T> with typed elements; supports copy-on-write and :[Mutable] in-place variants
Store Complete Persistent key-value storage with versioning, structural diffs, and compilation
System Complete Channels: console, file, system, dir, process with validates verbs
Parse Complete JSON, TOML, URL, Base64, CSV codecs with Value/Url types, and generic tokenization with Token/Rule types
Math Complete Numeric functions: abs, min, max, floor, ceil, pow, clamp, sqrt, log
Types Complete Type validation and conversion: String ↔ Integer, String ↔ Float, String ↔ Decimal, Character ↔ Integer; Result/Option validators and unwrap
Path Complete File path manipulation: join, parent, stem, extension, normalize
Pattern Complete Regex operations: test, search, replace, split with Match type
Format Complete String/number formatting (pad, hex, bin) and time/date formatting
Bytes Complete Byte sequence manipulation: create (bytearray), slice, index access. Hex encoding is in Parse (hexadecimal)
Hash Complete Cryptographic hashing: SHA-256, SHA-512, BLAKE3, HMAC-SHA256
Random Complete Random value generation: integer, decimal, boolean, choice, shuffle
Time Complete Time, Date, Clock, Duration, DateTime, Weekday with calendar operations
Log Complete ANSI color constants and structured logging with detached verb
Network Complete TCP sockets: socket, server, accept, message channels with Socket type; pairs with streams for accept loops
Language Complete Natural language processing: word/sentence extraction, stemming, edit distance, phonetic codes, n-grams, stopwords, frequency analysis
UI Complete Base UI types: AppEvent algebraic event type, Key:[Lookup], Color:[Lookup], Position struct
Terminal Complete TUI primitives via ANSI escape codes: raw/cooked mode, cursor control, clear, terminal size, TerminalAppEvent
Graphic Complete GUI primitives via SDL2 + Nuklear: window, button, label, checkbox, slider, progress, text input. Requires SDL2
Sqlite Experimental SQLite database access: open, query, execute, prepare, cursor iteration. Vendored SQLite amalgamation (no external dependency)
Prove Complete Syntax tree access for Prove source code: parse, traverse, inspect nodes. Requires tree-sitter