manuel-rubio

manuel-rubio

Hi everyone! :waving_hand:

Like many in the BEAM community, we’ve often felt the friction of running Dialyzer in our daily development workflow and CI pipelines: monolithic PLT files that take minutes to build, heavy CPU and RAM consumption, and the occasional cryptic warning or false positive on defensive clauses.

To solve this, we’ve been developing Prisma: a modern, hybrid static type analyzer for Elixir and Erlang designed for sub-second feedback, granular caching, and high developer trust.


:light_bulb: How is Prisma different?

  1. Modular .pplt Tables (No monolithic PLT rebuilds)
    Instead of baking Erlang/OTP and all your dependencies into a single 100MB+ monolithic .plt blob, Prisma introduces isolated, binary .pplt (Prisma Persistent Lookup Tables):

    • Each package in mix.lock gets its own portable .pplt.
    • Bumping or changing one dependency only recompiles that specific table.
    • At analysis time, Prisma merges dependency tables dynamically in-memory in ~15 ms, so analysis time is spent solely on your application code.
    • Package authors can even pre-build and publish .pplt files directly inside their Hex packages (mix prisma.build).
  2. Hybrid Verification (Success Typing + Gradual Typing)

    • Success Typing: Infers true domain/range contracts to spot impossible paths without requiring annotations everywhere.
    • Gradual Subtyping (~ & ≲): Strictly verifies your @spec contracts (argument types, return consistency, map shapes).
    • Oxbow / Dead Code Pruning: Flags dead parameters and impossible guard clauses with the highest degree of certainty. If Prisma flags an issue, you can refactor or remove it with confidence.
  3. First-Class Elixir Support
    Prisma reads both Erlang AST and Elixir’s native Dbgi / elixir_v1 chunks, with built-in awareness of:

    • Struct patterns (%User{})
    • Keyword lists ([key: :val])
    • String binaries (String.t()) and atoms
    • Multi-clause pattern matches and SSA variable versions

:bar_chart: Real-World Benchmarks (Hyperfine on Apple M1, Erlang/OTP 29)

We benchmarked Prisma on real production code using the official RabbitMQ repository (commit 5dacb85), comparing both the core server (234 BEAM modules) and a full monorepo of 7 applications (440 BEAM modules):

Metric Prisma (440 mod) Dialyzer (440 mod) Advantage
Wall-Clock Time 3.02 s 17.27 s 5.7× — 6.3× faster
Total CPU Time 3.25 s 67.55 s 20.8× less CPU
Peak RAM (RSS) 536 MiB 1,456.7 MiB 2.7× less memory
Instructions Retired 33.7 B 467.2 B 13.9× fewer instructions
  • Fault Detection (125 injected mutants across 5 mutation classes):
    • Prisma: Detected 125 / 125 (100%) of faults, with 0 spurious warnings outside mutated functions.
    • Dialyzer: Detected 123 / 125 (98.4%), but emitted 201 spurious warnings.
    • Gradualizer: Detected 68 / 125 (54.4%), and ran 5.3× slower on 440 modules (35.9s vs 6.8s).

:rocket: Getting Started with Mix

Adding Prisma to your project is straightforward. In your mix.exs:

def deps do
  [
    {:prisma, "~> 0.1.0", only: [:dev, :test], runtime: false}
  ]
end

Then run:

# Analyze your project
mix prisma

# Output formats for CI or editor linters
mix prisma --format human    # default rich ANSI output
mix prisma --format oneline  # ideal for vim/neovim/vscode diagnostics
mix prisma --format json     # for CI automation & bots

You can also customize settings in mix.exs:

def project do
  [
    app: :my_app,
    version: "0.1.0",
    prisma: [
      mode: :hybrid,   # :hybrid | :gradual | :discrepancy
      oxbow: true,     # dead code / unused parameter detection
      format: :human
    ],
    deps: deps()
  ]
end

:link: Links & Community Feedback

  • GitHub:

We would love for you to try it out on your Elixir applications and libraries! Feel free to share your thoughts, report issues, or suggest improvements. What are your biggest friction points with static typing in Elixir today?

Showing Posts 1 to 3

schwarz

schwarz

Incredible performance diff when you consider that Prisma stays on the BEAM and doesn’t use Rust! Fantastic work Manuel!

mudasobwa

mudasobwa

Creator of Cure

Using Rust does not make anything faster just because. The language itself cannot be faster than another language. Rust has its own applications (very limited,) but mentioning it everywhere because of rumors and hearsay is becoming really boring.

hfiguera

hfiguera

This is really cool! Thanks Manuel for shared it :rocket:

— All posts loaded —

Where Next? Top

Trending in Announcing Top

mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
danschultzer
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
danschultzer
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and co...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews