Forma
Forma is a pre-alpha programmable type system for Lisp: a typed, homoiconic Lisp whose preludes define typed forms for domain-specific languages and portable artifacts. Install the public package with
npm install @forma-language/forma effect, or try the browser playground at https://forma-lang.com/playground.
Forma source files use .lisp; project metadata uses forma.json and forma.lock.
APIs, package boundaries, syntax, and artifact formats are still evolving. The TypeScript host includes a source-built forma CLI (check, run, test, fmt, repl, explain, describe, mcp, and JSON commands) and daemon, with filesystem module commands described in File modules. The TypeScript engine is the only implementation; it also powers the browser tools and language server. The earlier OCaml engine was removed. Conformance fixtures and reviewed stored goldens pin implemented behavior. The TypeScript engine distinguishes Int and Float, including integral Float literals and results; Int arithmetic checks the JavaScript safe integer range. One Hindley–Milner type checker (packages/ts/src/type/) checks pure, DSL, and Effect programs, including structural open polymorphic variants ((Variant (Tag Payload) & e) + (variant :Tag val), RFC 0030), GADTs and existentials, direct-style algebraic effects and unified tail-resumptive handle (RFC 0003 Stage 1, backwards-compatible with do!/pure/catch/provide/layer), and Effect signature polymorphism (RFC 0023 stages 1–3 and 5); Effect generation, canonical artifact validation, host/CLI checks, and workspace analysis all consume it, and the legacy mechanics/check.ts solver has been retired. Effect 4 TypeScript (Effect.gen, yield*, Effect.provideService, Effect.catchTag) is the first compilation backend (alongside in-process runEffectProgram execution); future zero-overhead evidence-passing JS and Perceus-FBIP native/Wasm backends, without row subtraction, and general multi-shot continuations remain planned. The host layer ships checkedRun, CapabilityManifest pre-execution inspection, typed createLanguage capabilities with onHostCall author-span hooks, cooperative resource budgets, and forma-journal/v1 host-call record and deterministic replay. The language server resolves multi-file local imports, forma:* libraries, and forma.json packages; workspace analysis memoizes closed HM SCCs per document. An independent trusted kernel remains unfinished. A fresh clone uses pnpm install --frozen-lockfile without a sibling checkout or link step.
Getting started
- Core cheat sheet: Checked syntax, types, modules, forms, effects, builtin signatures, and fixes for common diagnostics.
- Embedding: Experimental promise-based host facade for checking, running, capabilities, form discovery, and canonical IR emission without Effect imports.
- Authoring: Install from source before publication, check and run a first file, then use file modules, typed forms, diagnostics, formatting, and the REPL. Links to runnable project and Node embedding examples.
- Quick start: Setup, examples, package layout, and current project status.
- TypeScript engine: Embedding the reader, evaluator, typechecker, VM, and elaborator.
- Language guide: Syntax, values, types, macros, effects, and elaboration.
- Structure and Interpretation of Forma Programs: SICP-style introduction covering functions, processes, data abstraction, symbolic data, effects, streams, an interpreter, macros, and typed forms, with examples run on the current engine.
- Domain modeling in Forma: A wholesale ordering workflow designed in the style of Domain Modeling Made Functional, with brands, refinements, tagged choices, typed errors, and service requirements, compiled to Effect TypeScript; lists current modeling limits.
- File modules: Explicit imports, exports, compile-time form libraries, project preludes, and offline package imports through
forma.json, verifiedforma.lock, committed vendor sources, and explicit add/update/verify/vendor commands. - Literate Markdown & ontology export: First-class
.md/.forma.mdauthoring, exact Markdown diagnostic remapping, lossless fence formatting, LSP support, and transactional store Markdown projection (forma store export --format md).
For agents
MCP server: Configure Claude Code or Codex with structured check, run, format, diagnostic explanation, and node-addressed editing tools, plus a code-mode REPL that checks, expands, generates and runs Effect programs and can evolve the language through session preludes. The REPL is also hosted at https://forma-lang.com/mcp, without
:run.Flagship host example: End-to-end incident-response policy host demonstrating
describe(),CapabilityManifestinspection, ungranted capability rejection,node:worker_threadsbudgets withonHostCallspan approval, andforma-journal/v1deterministic replay.Writing a form: Define domain vocabulary with typed forms, form-local constant extensions, checked documentation examples, and elaboration hooks.
Preludes: Catalog of the repository preludes with maturity labels; each reference page is generated at site build from form descriptors,
(: name type)signatures, docstrings, comments, and per-form examples checked bypnpm check.Architecture: Engine boundary, host ABI and JSON CLI, artifacts, and conformance goldens.
Technical specification: End-to-end technical specification of Forma's 7 layers (reader, expansion/elaboration, unified HM/Effect checker, backends/runtime, RFC 0029 content-addressed store, RFC 0027/0028 contracts and bounded verification, tooling) and maturity boundaries.
Forma for Effect: Generate Effect TypeScript from checked Forma declarations and programs. Browser sandbox: https://forma-lang.com/playground/sandbox/effect.
Prelude-defined RPC: Unary RPC contracts and named groups emitted through a dedicated prelude to native Effect code; shared schema imports, explicit native handlers and transports, and current limits.
Prelude-defined Cluster entities: Prototype Effect Cluster entities with pure, checked state transitions, required deduplication keys for persisted state-changing commands, and native
Entity.make/toLayeroutput; in-memory state only, with runners, storage, workflows, singletons, and cron not implemented.One Effect system from several preludes:
generateEffectSystemlinks RPC, HTTP API, and Cluster declarations with ordinary Effect forms into checked native modules plus a graph of services, operations, endpoints, RPCs, entities, and their relations. File modules select libraries through forma:effect/rpc, forma:effect/http-api, and forma:effect/cluster imports and work with plain forma check; standalone generators retain their options, and nothing consumes the graph yet.Forma for Effect UI: Elm Architecture prototype on Effect (Foldkit merged into Effect) with exhaustive update, checked command recovery, and pure views; shared HttpApi client generation and live DOM preview remain proposed. Browser sandbox: https://forma-lang.com/playground/sandbox/effect-ui.
Effect UI prototype reference: Isolated prelude generator, supported forms, mounting, and current limits.
Forma for Effect Torch: Pre-alpha prelude exploration for declarative tensor, layer, and model graphs targeting
@effect-torch/coreas checked typed IR; code generation and live Preview Portal execution are planned. Browser sandbox: https://forma-lang.com/playground/sandbox/effect-torch.Forma for Effect PDF: Pre-alpha prelude exploration for declarative typed documents (
document,page,section,table) with checked data bindings; live PDF rendering in the Preview Portal is planned. Browser sandbox: https://forma-lang.com/playground/sandbox/effect-pdf.Forma for workflows: Pre-alpha prelude exploration for typed automations (
workflow,trigger,step) with closed capability and error contracts; runtime execution and live Preview Portal rendering are planned. Browser sandbox: https://forma-lang.com/playground/sandbox/workflows.Forma for ontology modeling: Pure-IR domain modeling using
preludes/ontology.lisp(entities, links, queries, and content-addressed payload contracts) without TypeScript code generation. Browser sandbox: https://forma-lang.com/playground/sandbox/ontology.Forma for email automation: Email rule prelude prototype with closed lanes, first-match decisions, pure rules, and typed delivery recovery; scheduling, rate enforcement, and dry runs are not implemented. Browser sandbox: https://forma-lang.com/playground/sandbox/email.
Clojure spellings:
preludes/modules/clojure.lisp, a shipped macro library giving Forma modules Clojure spellings (def,defn,if-let, threading) over Forma semantics; keyword access, set and function literals, multi-aritydefn, and any Clojure surface, adapter, or emitter are not implemented. Browser sandbox: https://forma-lang.com/playground/sandbox/clojure.Effect reference: Supported schemas, services, errors, resources, and operations.
Language services: Analysis, node identity, observations, and structural edit scripts.
Optional
- Conformance: Fixtures and stored goldens that pin implemented engine behavior.
- Retiring the OCaml engine: Why TypeScript is the only engine, the 2026-10-06 engine benchmarks, and remaining performance follow-ups.
- Roadmap: Current foundation and planned work; planned features are not compatibility promises.
- Direct-style algebraic effects &
handle(RFC 0003): Implemented Stage 1 direct-style effect bodies and unified tail-resumptivehandleon Effect 4 TypeScript, plus planned evidence-passing JS and Perceus-FBIP native/Wasm backends. - Open polymorphic variants (RFC 0030): Structural open and closed
(Variant ...)types and(variant :Tag val)values complementing open records ({:name String & r}). - Record row rollout: Implemented closed-record operations and links to proposed generic constraints, normalization, typed reflection, and bounded row mapping.