3 ms·
> In Haskell, higher level functions can be composed from other functions, which is very clean. But the state isn't inside the function > ... Another perspecti
by TuringTest 9y ago
> In Haskell, higher level functions can be composed from other functions, which is very clean. But the state isn't inside the function
> ... Another perspective is thinking about building large scale systems and coupling of modules
Both models have been proven formally equivalent, so it doesn't matter which one you use as the base computation model "all the way down"; you can always transform one into the other.
So in practice you end using the one which best represents the problem domain that you're solving. State-based object-orientation works best to represent simulations of the world where previous states are not needed. Functional is best when you need to reason about the properties of the system, since it allows you to access any present or past state of the computation.