Prism: An Impure Functional Language with Typed Effects
The article introduces Prism, an impure functional programming language that integrates typed effects using a system based on algebraic effects and row polymorphism. It demonstrates how Prism's type system tracks side effects like state, exceptions, and I/O, allowing pure and impure code to coexist safely within a unified framework.
Background
- Stephen Diehl is a well-known figure in the Haskell and programming-languages community, often writing about type systems, functional programming, and PL theory.
- This post describes "Prism," a toy/demonstration language Diehl built that merges ideas from Haskell (pure functional programming) with algebraic effects (a way to handle side effects like IO, state, or exceptions in a typed, composable way).
- Prism is "impure" — unlike Haskell, which fences off side effects inside the IO monad, Prism lets effects appear anywhere in a function's type signature via a row of effect labels.
- The key technical idea is "typed effects" or "algebraic effects and handlers," a research topic (e.g., in the Koka or Eff languages) that makes effect tracking more fine-grained than monads.
- This matters because it shows a concrete, small-scale implementation of an alternative to Haskell's monad-centric approach, relevant to debates about how to manage side effects in typed functional languages.