3 ms·
It is interesting that the solution for order dependency problem essentially turns functions that update the state into functions that writes a program in a min
by fpoling 11y ago
It is interesting that the solution for order dependency problem essentially turns functions that update the state into functions that writes a program in a mini-language. When interpreted, the language updates the state. In Haskell this is known as Operational Monad [1].
The nice thing with that approach is that it decouples complex application-specific logic from state management allowing to test both components separately. Another bonus is that it enables things like Elm's time traveling debugger [2].
The drawback is that this adds maintenance burden as now one has to deal with the intermediate language. If that language is a poor fit for the problem, the burden can be rather high. This is especially bad in JavaScript where lack of rich static types makes generating programs and writing an interpreter is rather error prone.
[1] https://wiki.haskell.org/Operational https://wiki.haskell.org/Operational
[2] http://debug.elm-lang.org/ http://debug.elm-lang.org/