Software Development

Effect Systems: Type-Level Side Effects, and Whether Mainstream Languages Will Ever Adopt Them

A function’s type can already say what it returns. Effect systems ask it to say what it does on the way there.

Type systems have spent the last decade absorbing ideas that used to live only in academic papers, null safety, algebraic data types with exhaustive pattern matching, and now, gradually, something bigger: tracking a function’s side effects directly in its type, the same way its return value already is. OCaml, Koka, and Unison each took a real swing at this. Only two of them actually finished the job, and the gap between those two and the third is exactly where the honest answer to “will mainstream languages ever adopt this” starts to take shape.

An Old Idea With a New Name

Effect systems are not a recent invention. David Gifford and John Lucassen described the first type-and-effect system at the 1986 ACM Conference on LISP and Functional Programming, followed by Lucassen’s 1987 MIT thesis and the pair’s “Polymorphic Effect Systems” at POPL 1988, all implemented in a real language called FX-87. The idea was to let a function’s type record not just its return value but what it was allowed to do along the way, allocate memory in a particular region, mutate state, raise an exception. It stayed a mostly academic curiosity until Gordon Plotkin and Matija Pretnar’s “Handlers of Algebraic Effects,” at ESOP in 2009, gave the field a cleaner foundation: effects as ordinary operations a program performs, and handlers as ordinary code that decides what those operations actually mean, composably, without baking any of it into the language’s syntax.

Koka Builds the Type System Around It

Daan Leijen’s Koka, a research language out of Microsoft Research, took that foundation and made it the organizing principle of an entire type system. His 2014 paper, “Koka: Programming with Row Polymorphic Effect Types,” describes a function type that carries an explicit row of the effects it may perform, and the compiler infers and checks that row the same way it infers ordinary types. A function that can’t do anything but compute is typed as total. A function that might fail or print gets that fact stamped into its signature automatically, and an effect that goes unhandled is a compile error, not a surprise at runtime. Koka’s own README is candid about where the project actually stands: as of its most recent release in March 2026, it still describes itself as “a research language that is currently under development and not quite ready for production use.”

Unison Ties Effects to Its Abilities

Unison, a separate language unrelated to the older file-synchronization tool of the same name, calls the same idea abilities, borrowing the theoretical basis from Sam Lindley, Conor McBride, and Craig McLaughlin’s 2017 paper “Do Be Do Be Do.” A Unison function’s type looks like I ->{A} O, where A is the set of abilities it requires, and calling a function that needs an ability the current context doesn’t provide is a static ability-check failure, caught before the program ever runs. Like Koka, an ability requirement can’t quietly disappear; it has to be either satisfied by the surrounding context or explicitly handled.

KokaUnisonOCaml 5
Effects tracked in the typeYes, row-polymorphicYes, ability setsNo, by current design
Unhandled effectCompile errorCompile-time ability check failureRuntime Effect.Unhandled exception
Theoretical originLeijen, MSFP 2014Lindley, McBride & McLaughlin, “Do Be Do Be Do,” 2017Sivaramakrishnan et al., “Retrofitting Effect Handlers onto OCaml,” PLDI 2021

Where OCaml Actually Landed

OCaml’s story is the most instructive because it’s the one running in production somewhere real. KC Sivaramakrishnan joined what became the Multicore OCaml project in December 2014, the effort merged into mainline OCaml in January 2022, and OCaml 5.0 shipped on December 16, 2022, “nearly 8 years after the first commit,” in Sivaramakrishnan’s own words. What shipped was the runtime mechanism, effect handlers as a genuine language feature, but deliberately not the type-level tracking Koka and Unison both have. OCamlverse’s own summary is direct about it: “the type system does not provide dedicated functionalities to track effects. In other words, algebraic effects in OCaml 5.0 are untyped.” Perform an effect nobody handles, and the program compiles cleanly, then fails at runtime with an Effect.Unhandled exception.

That gap hasn’t gone unnoticed inside the OCaml community. A 2026 open-source project called “unhandled,” built specifically as a static checker to catch what the compiler doesn’t, states its motivation in almost identical terms: “unlike languages such as Eff and Koka, effect handlers in OCaml do not provide effect safety.” Even a 2024 pull request adding cleaner effect syntax to the compiler surfaced a live disagreement among OCaml’s own developers, with one line from that discussion capturing the split plainly: “we should not recommend the general use of untyped effects.” Jane Street, which runs OCaml in production at scale, has said publicly that adopting the new runtime was harder than expected internally, a reminder that even the mechanism half of this feature, without the type-checking half, is real engineering work, not a free upgrade.

Desired: developers who want to use the language next year. Admired: developers who used it and want to continue. Koka and Unison aren’t tracked in this survey at all, a data point in itself. Source: 2025 Stack Overflow Developer Survey, Technology.

How Far This Still Is From the Mainstream

OCaml at least registers on a mainstream survey. Koka and Unison don’t appear on the Stack Overflow Developer Survey’s language list at all, which is its own kind of evidence about scale. Their GitHub footprints make the gap concrete in a different way.

GitHub stars, log scale, current as of 2026.

There’s already a cautionary tale inside mainstream language history for exactly this kind of feature. Java’s checked exceptions are, in effect, a primitive effect system, tracking one specific effect, what a function might throw, directly in its type signature. The industry’s reaction to that comparatively modest ask is well documented: a 2016 mining study of real Java repositories found that 84 percent of catch blocks caught an overly generic exception type rather than the specific one declared, and roughly a fifth were empty, developers routing around the very discipline the type system was trying to enforce. If a single tracked effect provoked that much workaround behavior, a full row-polymorphic or ability-based system tracking many effects at once is asking mainstream developers for a great deal more discipline than the historical record suggests they’ll willingly give.

Where effect systems already make sense today

  • Research and teaching contexts where precise, composable control over side effects is the point, not an obstacle
  • Greenfield systems willing to accept a small, unproven ecosystem in exchange for compile-time guarantees about what code can and can’t do
  • Teams already comfortable with row polymorphism or similar type-system machinery from Haskell-adjacent functional languages
  • Not, currently, a production OCaml codebase relying on effect safety, since that specific guarantee doesn’t exist yet at the language level

What We Learned

Effect systems trace back to 1986 and got their modern, composable foundation from Plotkin and Pretnar’s 2009 work on algebraic effect handlers, but the three languages putting real engineering behind the idea today have landed in two different places. Koka and Unison both track effects in the type system itself, making an unhandled effect a compile-time error, the strongest version of the promise.

OCaml shipped the harder, more consequential half, a production-grade concurrent runtime with real effect handlers, after nearly eight years of work, and deliberately left the type-tracking half for later, a gap its own community is still building external tools to patch. Layer Java’s checked-exceptions experience on top, one tracked effect that a large share of developers still routed around, and the honest read is that effect systems are a genuinely powerful idea whose adoption curve looks a lot longer than the theory alone would suggest.

Eleftheria Drosopoulou

Eleftheria is an Experienced Business Analyst with a robust background in the computer software industry. Proficient in Computer Software Training, Digital Marketing, HTML Scripting, and Microsoft Office, they bring a wealth of technical skills to the table. Additionally, she has a love for writing articles on various tech subjects, showcasing a talent for translating complex concepts into accessible content.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button