Haskell has the ST type for this, which is a stripped version of IO in which we can still make proper mutable inplace updates like in other languages, but there is a »runner« function called »runST«, which guarantees that the computation it contains does not leak any state to the outside – in other words, »runST <impure>« is pure from the outside. This allows embedding of mutable algorithms, e.g. inplace sorting of vectors, into pure code.
That's what Haskell calls "ST" and is far less powerful than the general notion of monads.
This is definitely cool, but monads is a more general concept. It can be used to isolate side-effects, but can also be used for many other things.
This is "const" in c++
I don't think this is the same. My C++ is getting rusty, so correct me if I'm wrong, but making a function const is mostly about making the "this" pointer const. A const function can still mutate global variables or call non-const functions, such as operator<< on cout. A pure D function can do neither of those things.
https://dlang.org/spec/function.html#pure-functions