Fintech company Mercury maintains a massive two-million-line Haskell codebase, demonstrating how functional programming can provide operational stability and institutional knowledge retention for rapidly scaling financial systems.
Key Points
- Mercury processes billions in transactions annually using a codebase maintained by a team of 1,500 employees, many of whom learn Haskell on the job.
- The engineering team utilizes Haskell’s type system to encode operational invariants, effectively turning institutional knowledge into compiler-enforced rules.
- Mercury adopted the Temporal framework for durable execution, replacing fragile, hand-rolled state machines with reliable, deterministic workflows.
- The company emphasizes "adaptive capacity" over simple failure prevention, focusing on building systems that degrade gracefully and remain understandable during high-growth periods.
- To maintain observability, the team favors "records of functions" over concrete modules, allowing for easier instrumentation and fault injection without modifying library source code.