2 ms·
By "imperative state" I mean state for which the ordering of state updates is set by the operational semantics of your language, or the execution model, or the
by Chattered 12y ago
By "imperative state" I mean state for which the ordering of state updates is set by the operational semantics of your language, or the execution model, or the way it ends up implemented on an abstract machine. In the case of Haskell, I mean the ordering of state updates you'd get if you used unsafePerformIO whenever you do your get, put and modify, which is generally going to be unpredictable.
If I'm working in code where the operational semantics is not fully defined or difficult to reason about, I might find myself reaching for the state monad, regardless of whether my language supports imperative state (such as with Ocaml). I brought up back-tracking parsers as an example.