Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Standard Library

Prism’s standard library is ordinary Prism source, not compiler built-ins. A small always-on Base supplies the core types, the type-class tower, and the common data modules in unqualified scope; everything else is opt-in via explicit import. The pages below are generated from the module sources, with signatures taken from the typechecker.

Merkle root

  • Scheme: prism-core-hash-v2
  • Hash: 5f74ceb8cdbb6bee38bb1d4797b4d7688c207bf37e02c35c3cc5ef7876557fa3
  • Compiler version: Prism v0.16.0

Modules

  • Base - Base, the always-on surface: wired-in types, the type-class tower, core combinators, and the effect/loop machinery.
  • Control.Fresh - The Fresh effect: a deterministic monotonic name supply (gensym).
  • Control.Layer - The children-and-rebuild interface a generic traversal runs on, and the collecting queries that ride it.
  • Control.Reader - The canonical Reader(r) effect: a read-only ambient environment.
  • Control.Rewrite - Strategy combinators: a pass as a composition of small local rules instead of a hand-written recursive match.
  • Control.State - The canonical State(s) effect: a threaded piece of mutable-looking state, interpreted by parameter passing.
  • Control.Validate - Validation as an algebraic effect.
  • Control.Writer - The canonical Writer(w) effect: accumulate output on the side.
  • Data.Bind - Binders, the two nameless coordinate systems, and the canonical rendering that makes alpha-equivalent terms identical.
  • Data.Bytes - Byte strings: the String/Bytes boundary, and the hex and base64 codecs.
  • Data.Char - ASCII character classification.
  • Data.Checked - Safe arithmetic families over the machine-integer lanes.
  • Data.Fixpoint - Least fixed points over a join-semilattice, solved by worklist.
  • Data.FlatArray - Flat, unboxed-element arrays: one typed surface over the raw-word buffers.
  • Data.Foldable - Generic operations over any Foldable container.
  • Data.Frozen - Frozen arrays: the immutable array representation.
  • Data.Graph - Directed graphs over an ordered node type, with the deterministic algorithms the compiler relies on internally, mirrored into Prism.
  • Data.IntMap - Persistent integer-keyed map: a big-endian patricia trie over 64-bit keys.
  • Data.IntSet - Sets of 64-bit integers, reusing the patricia trie.
  • Data.List - Singly-linked list operations.
  • Data.Map - Persistent ordered map: an AVL-balanced binary search tree over keys.
  • Data.Maybe - Operations over Option.
  • Data.Monad - Generic operations derived from the Applicative and Monad classes.
  • Data.Ordered - Explicit ordering witnesses: the branded, statically coherent path to ordered maps.
  • Data.Pretty - A Leijen-style pretty printer.
  • Data.Result - Operations over Result.
  • Data.Set - Ordered sets, reusing the balanced-tree map.
  • Data.String - String operations, byte-oriented and ASCII-accurate.
  • Data.Tensor - Dense multi-dimensional tensors over a flat FloatBuf.
  • Data.UnionFind - A persistent union-find (disjoint-set) over an ordered key type.
  • Data.Validation - Validation, the error-accumulating sibling of Result.
  • Data.Vec - Fixed-length vectors indexed by a Nat dimension.
  • Syntax.Analysis - Analysis walks over the surface syntax tree.
  • Syntax.Ast - The typed surface syntax that the prism-surface-syntax-v1 artifact decodes into.
  • Syntax.Codec - Codecs for the versioned syntax artifacts.
  • Syntax.Cursor - The mechanical half of recursive descent: a token cursor with peek, advance, and expect, and a Pratt driver over a binding-power table.
  • Syntax.Diagnostic - The typed vocabulary of the prism-syntax-diagnostics-v1 artifact.
  • Syntax.Edit - Span-addressed source edits that refuse rather than corrupt.
  • Syntax.Flow - Call-graph flow over a resolved document: occurrence analysis and liveness as one fixpoint.
  • Syntax.Identity - The identities a Prism source file carries, and the two of them a published artifact is enough to compute.
  • Syntax.Layout - The Prism-language reimplementation of the compiler’s layout pass: the offside rule that splices the virtual block delimiters.
  • Syntax.Lex - A Prism-language reimplementation of the compiler’s raw token layer: exact UTF-8 tokenization, literal payload decoding, and interpolation splitting.
  • Syntax.Parse - The public Prism-owned parser.
  • Syntax.Parse.Build - Canonical AST construction for a parser: every spanned node a production creates goes through a named builder here, so the meaning of a span or a synthesis bit is encoded once instead of being re-decided at hundreds of record literals.
  • Syntax.Parse.Decl - Whole-program and declaration parsing for the Prism-owned parser.
  • Syntax.Parse.DeclClass - Effects, classes, instances, canonical designations, and the shared alias declaration family for the Prism-owned parser.
  • Syntax.Parse.DeclStable - Pattern-synonym and stable-family declarations.
  • Syntax.Parse.Expr - The Prism-owned expression parser.
  • Syntax.Parse.GeneratedControl
  • Syntax.Parse.GeneratedPattern
  • Syntax.Parse.GeneratedType
  • Syntax.Parse.Pattern - Stable public facade for the generated Pattern-family parser.
  • Syntax.Parse.PatternSemantics - Pure Pattern action lowerings used by the generated structural parser.
  • Syntax.Parse.Support - The support layer of a production parser: the three-way parse outcome, the recursion budget, and the token classification every grammar family shares.
  • Syntax.Parse.Type - Stable public facade for the generated surface-type parser.
  • Syntax.Parse.TypeSemantics - Semantic checks behind the generated structural type parser.
  • Syntax.Query - A source query over a decoded prism-syntax-tokens-v1 artifact.
  • Syntax.Rename - Rename as a join against the resolver, not as a tree walk.
  • Syntax.Report - Caret rendering for Syntax.Diagnostic: the plain-text report the compiler prints for a refused source.
  • Syntax.Resolved - The typed vocabulary of the prism-resolved-syntax-v1 artifact.
  • Syntax.Source - Source identity for the versioned syntax artifacts: source files and half-open byte spans.
  • Syntax.Token - The token vocabulary of the prism-syntax-tokens-v1 artifact.
  • Syntax.Walk - Generic traversal over the surface syntax tree.
  • Arena - Arena: allocation as an algebraic effect.
  • Blit - Range copy over the sequence types a real primitive can back.
  • Cli - CLI: an applicative command-line parser as a first-class value.
  • Concurrent - Cooperative async/await concurrency as a single handler, polymorphic in the effects the fibers perform.
  • Incr - Incremental computation as a handler over a content-addressed dependency graph.
  • Json - JSON: a dynamic value tree, a total parser, a canonical encoder, and a typed layer.
  • Math - Named mathematical constants, matching Rust’s f64::consts surface.
  • Quickcheck - Property testing: run a boolean property over many generated inputs and report the first counterexample, deterministically.
  • Replay - Record/replay handlers for the capability effects.
  • Sequence - The one lazy iteration protocol: pull-based sequences with natural names.
  • Teleport - The checked mobility boundary for portable, single-use computations.
  • Test - Per-type value generators for property testing.
  • Time - Time: instants, wall-clock timestamps, durations, and RFC 3339.
  • Wire - The opt-in serialization layer.