Control.Monad.ST
- Package
- purescript-st
- Repository
- purescript/purescript-st
Re-exports from Control.Monad.ST.Internal
#ST Source
data ST :: Region -> Type -> Typedata ST t0 t1
The ST type constructor allows local mutation, i.e. mutation which
does not "escape" into the surrounding computation.
An ST computation is parameterized by a phantom type which is used to
restrict the set of reference cells it is allowed to access.
The run function can be used to run a computation in the ST monad.
Instances
#Region Source
data RegionST is concerned with restricted mutation. Mutation is restricted to a
region of mutable references. This kind is inhabited by phantom types
which represent regions in the type system.
#run Source
run :: forall a. (forall r. ST r a) -> aRun an ST computation.
Note: the type of run uses a rank-2 type to constrain the phantom
type 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
parentheses instead.