AUTO-UPDATED

A Couple Million Lines of Haskell: Production Engineering at Mercury

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.

Why it Matters

By treating the type system as an operational tool rather than just a correctness proof, Mercury successfully manages complex financial infrastructure with a rotating, generalist workforce. This approach proves that functional programming can scale effectively in high-stakes environments when organizations prioritize pragmatic boundaries and maintainable abstractions over academic purity.
Haskell.org Published by Haskell.org
Read original