3 ms·
Monads are just one design pattern for handling state, and not the only way. It's no different than having an OOP using dependency injection everywhere - it's a
by TuringTest 3y ago
Monads are just one design pattern for handling state, and not the only way. It's no different than having an OOP using dependency injection everywhere - it's a design decision that you use only when it makes architectural sense.
A shell is not more imperative than a processor - both are Turing machines, a completely functional mathematical object. Seeing them as imperative is a semantic interpretation of the people watching it, not an inherent property.
- c_crank 3y agoFunctional 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.