Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

sdiehl/prism

A small functional language with algebraic effects, multishot continuations, and native codegen

sdiehl/prism.json
{
"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

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.

Terminal window
nix build github:sdiehl/prism # binary at ./result/bin/prism
nix run github:sdiehl/prism # or run it directly
nix develop # dev shell: prism, LLVM, cargo, just on PATH

Native codegen needs LLVM 22 at runtime, so install it first:

Terminal window
brew install llvm@22 # macOS
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s 22 # Debian/Ubuntu

Then install prism (macOS Apple Silicon; Linux x86_64, aarch64):

Terminal window
curl --proto '=https' --tlsv1.2 -fsSL https://sdiehl.github.io/prism/install.sh | sh

The 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.

You need the standard Rust toolchain installed. Native codegen also needs clang on PATH (override with PRISM_CC).

Terminal window
brew install llvm # macOS
sudo apt install llvm-22-dev # Debian/Ubuntu
git clone https://github.com/sdiehl/prism.git
LLVM_SYS_221_PREFIX=$(brew --prefix llvm) cargo install --git https://github.com/sdiehl/prism
Terminal window
prism # interactive shell
prism program.pr # compile to a native binary named `program`
prism program.pr -o out # ...with a custom output path
prism program.pr -O2 # ...at optimization level 2
prism run program.pr # interpret instead of compiling
prism build # compile the enclosing project (needs a prism.toml), into target/
prism clean # remove the project's target/ directory
prism check # type check the enclosing project
prism check program.pr # type check one source file
prism pkg init # create a new package interactively
prism fmt program.pr # format source
prism dump core program.pr # inspect a phase: tokens|ast|types|core|core-json|core-hash|native-kont-table|native-kont-state-map|fbip|llvm

This project is licensed under the MIT License. See the [LICENSE]!(LICENSE) file for details.