3 ms·
Functional languages have either converged on either just allowing mutable values or relying on Monads as the ways of handling state. I'm not aware of a third s
by c_crank 3y ago
Functional languages have either converged on either just allowing mutable values or relying on Monads as the ways of handling state. I'm not aware of a third solution.
- TuringTest 3y agoYou can just use the classic temporal logic approach, where state is passed explicitly as a parameter and the new state is returned. This is what state monads are doing anyway under a hidden syntax, and for simple cases it may be easier that building a full dedicated monad.