| Copyright | (c) The University of Glasgow 1992-2002 | 
|---|---|
| License | see libraries/base/LICENSE | 
| Maintainer | [email protected] | 
| Stability | internal | 
| Portability | non-portable (GHC Extensions) | 
| Safe Haskell | Unsafe | 
| Language | Haskell2010 | 
The ST Monad.
The strict ST monad. The ST monad allows for destructive updates, but is escapable (unlike IO). A computation of type ST s a returns a value of type a, and execute in "thread" s. The s parameter is either
runST), orRealWorld (inside invocations of stToIO).It serves to keep the internal states of different invocations of runST separate from each other and from invocations of stToIO.
The >>= and >> operations are strict in the state (though not in values stored in the state). For example,
runST (writeSTRef _|_ v >>= f) = _|_
| Monad (ST s) | Since: base-2.1 | 
| Functor (ST s) | Since: base-2.1 | 
| MonadFix (ST s) | Since: base-2.1 | 
| Defined in Control.Monad.Fix | |
| MonadFail (ST s) | Since: base-4.11.0.0 | 
| Applicative (ST s) | Since: base-4.4.0.0 | 
| Show (ST s a) | Since: base-2.1 | 
| Semigroup a => Semigroup (ST s a) | Since: base-4.11.0.0 | 
| Monoid a => Monoid (ST s a) | Since: base-4.11.0.0 | 
type STRep s a = State# s -> (# State# s, a #) Source
runST :: (forall s. ST s a) -> a Source
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.
liftST :: ST s a -> State# s -> STret s a Source
unsafeInterleaveST :: ST s a -> ST s a Source
unsafeInterleaveST allows an ST computation to be deferred lazily. When passed a value of type ST a, the ST computation will only be performed when the value of the a is demanded.
unsafeDupableInterleaveST :: ST s a -> ST s a Source
unsafeDupableInterleaveST allows an ST computation to be deferred lazily. When passed a value of type ST a, the ST computation will only be performed when the value of the a is demanded.
The computation may be performed multiple times by different threads, possibly at the same time. To prevent this, use unsafeInterleaveST instead.
Since: base-4.11
    © The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
    https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/base-4.13.0.0/GHC-ST.html