Copyright | (c) Galois Inc 2014-2020 |
---|---|
License | BSD3 |
Maintainer | Joe Hendrix <jhendrix@galois.com> |
Stability | provisional |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 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
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#
.