What is Eff?
Eff is an experimental functional programming language built to explore algebraic effects — a powerful system for handling side effects like I/O, state, exceptions, concurrency, and randomness in a clean and modular way. Instead of deeply embedding effects in the runtime or syntax, Eff treats them as composable, programmable abstractions.
It influenced effect systems in languages like Koka, OCaml (effects extension), and even modern research into type-safe async models.
Specs
Language Type: Functional with algebraic effects
Released: ~2012 research prototype
Execution Model: Interpreted with runtime effect handlers
Paradigm: Functional + modular effect handling
Typing: Static with powerful type inference
Example Code (Random Number with Effect)
effect Random : int
let rollDice =
let x = perform Random in
(x mod 6) + 1
handle rollDice with
| Random -> fun _ -> 4 (* always roll 4 *)
This separates declaring an effect from handling it.
How It Works
Eff separates pure computation from effects using:
- perform → request an effect
- handle → define how effects behave
Handlers can:
- Transform behavior
- Filter or modify effects
- Restart execution
- Combine multiple effects
Common effect types:
| Effect | Use |
|---|---|
State |
Mutable values |
Exception |
Failure paths without try/catch syntax |
Random |
Probabilistic programs |
IO |
Output operations |
Async |
Structured concurrency |
This creates reusable effect systems instead of hardcoding them into the language runtime.
Strengths
- Clear and elegant handling of side effects
- Extremely flexible effect composition
- Influential in modern language design
- Great exploratory language for compiler and semantics research
Weaknesses
- Only a research-grade implementation
- Limited tooling and libraries
- Not production-ready for large applications
- Syntax and mental model require advanced FP understanding
Where to Run
Eff can be used via:
- Official Eff interpreter from research repository
- Linux/Mac builds
- Online experimental runners (unofficial)
- TIO.run (partial compatibility)
Many users now experiment with effect systems through successor languages.
Should You Learn It?
- For language theory, effect systems, or FP research: Yes
- For everyday software development: No
- For inspiration in compiler design: Very valuable
- For esoteric or unusual language exploration: Perfect fit
Summary
Eff helped pioneer algebraic effects — a model now spreading into cutting-edge language design. While experimental and incomplete, its ideas reshape how programmers think about state, concurrency, and effects, and continue influencing modern functional programming research.
Top comments (0)