|Maintainer||Reiner Pope <firstname.lastname@example.org>|
An indexed version of the ST monad with support for safely freezing
multiple arrays. Compare to the usual ST monad, where the only support
for safely freezing arrays is runSTUArray -- only one array may be frozen.
This version of the ST monad has two distinct stages of processing:
the normal stage, and the freeze stage. Reading and writing are
permitted in the normal stage; reading and freezing are permitted
in the freeze stage. This policy ensures that no writes occur after
the arrays have been frozen.
This ST is an indexed monad (see Control.Monad.Indexed) as well
as a normal monad. That is, each monadic value will have an
"ingoing" state thread as well as an "outgoing" state
thread. These state threads are similar to the ST monad's state
thread, except that they are now annotated with a stage name:
either Normal or Freeze.
|For lifting any operations containing writes but no freezes.
|For lifting any operations containing reads but no writes or freezes.
|For lifting an unsafeFreeze operation
|A computation containing some writes but no freezes: it starts
| and ends in the Normal stage.
|type STFreeze st s a = forall stg. st (stg s) (Freeze s) a||Source|
|A computation containing some freezes but no writes: it starts in
| any stage, but ends in the Freeze stage.
|type STRead st s a = forall stg. st (stg s) (stg s) a||Source|
|A computation containing only reads: it starts and ends in any
stage, but does not change stage. (Note that there would be no loss
of safety in allowing the stage to change, but it may result in
ambiguous types, or extra type annotations being required.)
runST = runIdentity . runSTT
|runSTT :: (forall s. STT m (stg1 s) (stg2 s) a) -> m a||Source|
|Runs the monad
|A restricted analog of Control.Monad.Trans.lift.
|Produced by Haddock version 2.4.2|