runST -package:ghc
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.
Return the value computed by an
ST computation. The
forall ensures that the internal state used by the
ST
computation is inaccessible to the rest of the program.
run an arrow with augmented state in the context of a simple state
arrow. An initial value for the new state component is needed.
This is useful, when running an arrow with an extra environment
component, e.g. for namespace handling in XML.
Deprecated: Use runSTT instead
Return the value computed by a state transformer computation. 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.)
Runs a monadic generating action in the
ST monad using a pure
pseudo-random number generator.
Examples
>>> import System.Random.Stateful
>>> let pureGen = mkStdGen 137
>>> (runSTGen pureGen (\g -> applySTGen random g)) :: (Int, StdGen)
(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})
Runs a monadic generating action in the
ST monad using a pure
pseudo-random number generator. Returns only the resulting
pseudo-random value.
Examples
>>> import System.Random.Stateful
>>> let pureGen = mkStdGen 137
>>> (runSTGen_ pureGen (\g -> applySTGen random g)) :: Int
7879794327570578227
Runs a monadic generating action in the
State monad using a
pure pseudo-random number generator.
Examples
>>> import System.Random.Stateful
>>> let pureGen = mkStdGen 137
>>> runStateGen pureGen randomM :: (Int, StdGen)
(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})
Runs a monadic generating action in the
ST monad using a pure
pseudo-random number generator.
Runs a monadic generating action in the
ST monad using a pure
pseudo-random number generator. Same as
runStateGenST, but
discards the resulting generator.
Runs a monadic generating action in the
StateT monad using a
pure pseudo-random number generator.
Examples
>>> import System.Random.Stateful
>>> let pureGen = mkStdGen 137
>>> runStateGenT pureGen randomM :: IO (Int, StdGen)
(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})
Runs a monadic generating action in the
StateT monad using a
pure pseudo-random number generator. Returns only the resulting
pseudo-random value.
Examples
>>> import System.Random.Stateful
>>> let pureGen = mkStdGen 137
>>> runStateGenT_ pureGen randomM :: IO Int
7879794327570578227
Runs a monadic generating action in the
State monad using a
pure pseudo-random number generator. Returns only the resulting
pseudo-random value.
Examples
>>> import System.Random.Stateful
>>> let pureGen = mkStdGen 137
>>> runStateGen_ pureGen randomM :: Int
7879794327570578227
A safe way to create and work with a mutable array before returning an
immutable array for later perusal. This function avoids copying the
array before returning it - it uses unsafeFreeze internally,
but this wrapper is a safe interface to that function.
A safe way to create and work with an unboxed mutable array before
returning an immutable array for later perusal. This function avoids
copying the array before returning it - it uses unsafeFreeze
internally, but this wrapper is a safe interface to that function.
Run
StateT in the base monad
Since 1.0.11
Run
StateT in the base monad
Since 1.0.11
Run a block using a MonadLogger instance which prints to
stderr.
Run a block using a MonadLogger instance which prints to
stdout.