The State type is just a convenient wrapper around regular functions. State makes it look, syntactically, like mutation is happening. You can use it to implement real mutable algorithms etc. But onces unfolded, it's just function calls.
ST, on the other hand, wraps true mutation. Is extends its secret magic sauce hooks into the compiler and will generate real, actual (thread-local) mutation under the hood, in a way that guarantees the effects cannot escape the current context in which mutation is allowed.
The State type is just a convenient wrapper around regular functions. State makes it look, syntactically, like mutation is happening. You can use it to implement real mutable algorithms etc. But onces unfolded, it's just function calls.
ST, on the other hand, wraps true mutation. Is extends its secret magic sauce hooks into the compiler and will generate real, actual (thread-local) mutation under the hood, in a way that guarantees the effects cannot escape the current context in which mutation is allowed.