runST package:protolude

Return the value computed by a state thread. The forall ensures that the internal state used by the ST computation is inaccessible to the rest of the program.
Unwrap a state monad computation as a function. (The inverse of state.)