sdiehl/prism
{ "createdAt": "2026-06-20T08:17:48Z", "defaultBranch": "main", "description": "A small functional language with algebraic effects, multishot continuations, and native codegen", "fullName": "sdiehl/prism", "homepage": "https://sdiehl.github.io/prism/", "language": "Rust", "name": "prism", "pushedAt": "2026-07-12T07:11:06Z", "stargazersCount": 115, "topics": [], "updatedAt": "2026-07-12T17:36:37Z", "url": "https://github.com/sdiehl/prism"}
Prism
A small functional language with algebraic effects, multishot continuations, and native codegen.
Prism is an impure functional programming language whose type system tracks side effects. Effect sets are inferred, extensible rows that compose through ordinary calls instead of monads, and they track observability rather than implementation: an effect handled inside a function vanishes from its type, so internally effectful code can still be analyzed, optimized, and reused as pure code. The language also has rank-N polymorphism, typeclasses, first-class lenses, fusing streams, deterministic reference counting, and native codegen through LLVM.
The compiler is built around deterministic simulation testing at the language level. Prism programs elaborate to a strict A-normal-form call-by-push-value core, definitions and packages are content-addressed by hash, project builds can explain their lineage, and suspended continuations carry the code identity they may resume against. The compiler also builds to WebAssembly, so the playground, REPL, and gallery run in the browser; the interpreter is a CEK machine modeled in Lean and serves as the differential oracle every native backend must match byte-for-byte.
Try it in the browser at the Prism playground.
Read the language specification and the compiler documentation.
The [examples/]!(./examples) directory contains a tour of most advanced features, and see my blog post about the project design.
Install
Section titled “Install”nix build github:sdiehl/prism # binary at ./result/bin/prismnix run github:sdiehl/prism # or run it directlynix develop # dev shell: prism, LLVM, cargo, just on PATHmacOS / Linux
Section titled “macOS / Linux”Native codegen needs LLVM 22 at runtime, so install it first:
brew install llvm@22 # macOScurl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s 22 # Debian/UbuntuThen install prism (macOS Apple Silicon; Linux x86_64, aarch64):
curl --proto '=https' --tlsv1.2 -fsSL https://sdiehl.github.io/prism/install.sh | shThe installer verifies the release tarball’s SHA-256 against the release manifest (and its build-provenance attestation when an authenticated gh is available) before unpacking, and installs to ~/.local/bin without sudo. If Nix is present it uses the flake instead, with hashes verified by the Nix store.
Also available: brew install sdiehl/prism/prism, docker run ghcr.io/sdiehl/prism, and deb/rpm/apk/pacman packages on the releases page.
From Source
Section titled “From Source”You need the standard Rust toolchain installed. Native codegen also needs clang on PATH (override with PRISM_CC).
brew install llvm # macOSsudo apt install llvm-22-dev # Debian/Ubuntu
git clone https://github.com/sdiehl/prism.gitLLVM_SYS_221_PREFIX=$(brew --prefix llvm) cargo install --git https://github.com/sdiehl/prismprism # interactive shellprism program.pr # compile to a native binary named `program`prism program.pr -o out # ...with a custom output pathprism program.pr -O2 # ...at optimization level 2prism run program.pr # interpret instead of compilingprism build # compile the enclosing project (needs a prism.toml), into target/prism clean # remove the project's target/ directoryprism check # type check the enclosing projectprism check program.pr # type check one source fileprism pkg init # create a new package interactivelyprism fmt program.pr # format sourceprism dump core program.pr # inspect a phase: tokens|ast|types|core|core-json|core-hash|native-kont-table|native-kont-state-map|fbip|llvmLicense
Section titled “License”This project is licensed under the MIT License. See the [LICENSE]!(LICENSE) file for details.