Monad. ST. Internal
ST type constructor allows local mutation, i.e. mutation which
does not "escape" into the surrounding computation.
ST computation is parameterized by a phantom type which is used to
restrict the set of reference cells it is allowed to access.
run function can be used to run a computation in the
Note: the type of
run uses a rank-2 type to constrain the phantom
r, such that the computation must not leak any mutable references
to the surrounding computation. It may cause problems to apply this
function using the
$ operator. The recommended approach is to use