最佳答案
I understand that the ST monad is something like a little brother of IO, which in turn is the state monad with added RealWorld
magic. I can picture states and I can picture that RealWorld is somehow put into IO, but every time I write a type signature of ST
the s
of the ST monad confuses me.
Take, for example, ST s (STArray s a b)
. How does the s
work there? Is it just used to build up some artificial data dependency between computations without being able to be referenced like states in the state monad (due to the forall
)?
I'm just throwing out ideas and would really appreciate someone more knowledgeable than I to explain it to me.