Copyright | (c) Galois Inc 2014-2020 |
---|---|
License | BSD3 |
Maintainer | Joe Hendrix <jhendrix@galois.com> |
Stability | provisional |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
What4.Utils.MonadST
Description
This module defines the MonadST class, which contains the ST and IO monads and a small collection of moand transformers over them.
Documentation
class Monad m => MonadST s m | m -> s where Source #
Instances
MonadST RealWorld IO Source # | |
MonadST s (ST s) Source # | |
MonadST s m => MonadST s (ReaderT r m) Source # | |
MonadST s m => MonadST s (StateT u m) Source # | |
MonadST s m => MonadST s (StateT u m) Source # | |
(MonadST s m, Monoid w) => MonadST s (WriterT w m) Source # | |
(MonadST s m, Monoid w) => MonadST s (WriterT w m) Source # | |
MonadST s (VarRecorder s t) Source # | |
Defined in What4.Expr.VarIdentification Methods liftST :: ST s a -> VarRecorder s t a Source # | |
MonadST s m => MonadST s (ContT r m) Source # | |
The strict ST
monad.
The ST
monad allows for destructive updates, but is escapable (unlike IO).
A computation of type
returns a value of type ST
s aa
, and
execute in "thread" s
. The s
parameter is either
- an uninstantiated type variable (inside invocations of
runST
), or RealWorld
(inside invocations ofstToIO
).
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) = _|_
Instances
MonadST s (ST s) Source # | |
MonadFail (ST s) | Since: base-4.11.0.0 |
MonadFix (ST s) | Since: base-2.1 |
Applicative (ST s) | Since: base-4.4.0.0 |
Functor (ST s) | Since: base-2.1 |
Monad (ST s) | Since: base-2.1 |
MonadThrow (ST s) | |
PrimBase (ST s) | |
PrimMonad (ST s) | |
RandomGen g => FrozenGen (STGen g) (ST s) | |
Monoid a => Monoid (ST s a) | Since: base-4.11.0.0 |
Semigroup a => Semigroup (ST s a) | Since: base-4.11.0.0 |
Show (ST s a) | Since: base-2.1 |
RandomGen r => RandomGenM (STGenM r s) r (ST s) | |
Defined in System.Random.Stateful Methods applyRandomGenM :: (r -> (a, r)) -> STGenM r s -> ST s a | |
RandomGen g => StatefulGen (STGenM g s) (ST s) | |
Defined in System.Random.Stateful Methods uniformWord32R :: Word32 -> STGenM g s -> ST s Word32 uniformWord64R :: Word64 -> STGenM g s -> ST s Word64 uniformWord8 :: STGenM g s -> ST s Word8 uniformWord16 :: STGenM g s -> ST s Word16 uniformWord32 :: STGenM g s -> ST s Word32 uniformWord64 :: STGenM g s -> ST s Word64 uniformShortByteString :: Int -> STGenM g s -> ST s ShortByteString | |
type PrimState (ST s) | |
Defined in Control.Monad.Primitive type PrimState (ST s) = s | |
type MutableGen (STGen g) (ST s) | |
Defined in System.Random.Stateful type MutableGen (STGen g) (ST s) = STGenM g s |
RealWorld
is deeply magical. It is primitive, but it is not
unlifted (hence ptrArg
). We never manipulate values of type
RealWorld
; it's only used in the type system, to parameterise State#
.