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, derived lenses and optic paths, fusing streams, deterministic reference counting, and native codegen through LLVM, with an optional textual MLIR backend for parity checking.
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 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/ directory contains a tour of most advanced features; my blog post explains the project design.
nix build github:sdiehl/prism # binary at ./result/bin/prism
nix run github:sdiehl/prism # or run it directly
nix develop # dev shell: LLVM, cargo, just; target/release on PATHNative codegen needs LLVM 22 at runtime, so install it first:
brew install llvm@22 # macOS
curl -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 | PRISM_VERSION=v0.18.0 shThe installer verifies each release asset's SHA-256 against the release manifest (and its build-provenance attestation when an authenticated gh is available) before unpacking. It installs prismup, the Prism toolchain manager, to ~/.prismup/bin and uses it to install the compiler; installed versions live under ~/.prismup/prism/ and prismup -s <version> switches between them. No sudo. If Nix is present it uses the flake instead, with hashes verified by the Nix store.
Also available via a variety of other package managers:
# Homebrew
brew install sdiehl/prism/prism
# Docker
docker run ghcr.io/sdiehl/prism --version
# Debian / Ubuntu (LLVM repository, then package)
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s 22
curl -fLO https://github.com/sdiehl/prism/releases/download/v0.18.0/prism_0.18.0_amd64.deb && sudo apt install ./prism_0.18.0_amd64.deb
# Fedora / RHEL
sudo dnf install https://github.com/sdiehl/prism/releases/download/v0.18.0/prism-0.18.0-1.x86_64.rpm
# Arch (prebuilt package or local PKGBUILD)
sudo pacman -U https://github.com/sdiehl/prism/releases/download/v0.18.0/prism-0.18.0-1-x86_64.pkg.tar.zst
curl -fLO https://github.com/sdiehl/prism/releases/download/v0.18.0/PKGBUILD && makepkg -siYou need the standard Rust toolchain installed. Native codegen also needs clang on PATH (override with PRISM_CC).
# macOS
brew install llvm@22
LLVM_SYS_221_PREFIX="$(brew --prefix llvm@22)" \
PRISM_CC="$(brew --prefix llvm@22)/bin/clang" \
cargo install --git https://github.com/sdiehl/prism
# Debian/Ubuntu (after enabling apt.llvm.org as above)
sudo apt install llvm-22-dev libpolly-22-dev clang-22
LLVM_SYS_221_PREFIX=/usr/lib/llvm-22 \
PRISM_CC=/usr/lib/llvm-22/bin/clang \
cargo install --git https://github.com/sdiehl/prismprism # 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 build --watch --verbose # rebuild on edits; show unit/Merkle impact and timing
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 one phase (`prism dump --help` lists every phase)This project is licensed under the MIT License. See the LICENSE file for details.
