Peter Marreck
Jul 23, 2017 · 1 min read

That pure FP languages such as Haskell normally prevent mutability by not allowing assignment is neither here nor there. All FP languages must allow mutability in some manner or in some context if you want to get any real work done.

These statements contradict each other. There are many domains where Haskell accomplishes plenty of work while still remaining pure to the core. Now you may argue that as soon as it talks to a mutable database or writes to a file (which is what I think you meant by “work”), it’s violated its own principles, but a mutable database is not the only kind of long-term state storage, and Haskell has specific mechanisms in place (such as the I/O monad) to control side-effects with mathematical certainty.

A little while back, mostly as an exercise, I refactored some Elixir code (a maze generator) that dipped into a mutable store, and returned its behavior to fully functional/immutable… (the code, and my thoughts on it) While this is a toy example, this is arguably a pattern that can be repeated.

Peter Marreck

Written by

Entrepreneur/startup dev loves open source, crypto, FP, the smart/fun/open-minded, games, techno, Tesla, BTC. Outspokenly centrist. Evidence-base all the things