Copyright | (c) Galois Inc 2014-2020 |
---|---|
License | BSD3 |
Maintainer | Joe Hendrix <jhendrix@galois.com> |
Stability | provisional |
Safe Haskell | Safe |
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, Monoid w) => MonadST s (WriterT w m) Source # | |
(MonadST s m, Monoid w) => MonadST s (WriterT w m) Source # | |
MonadST s m => MonadST s (StateT u m) Source # | |
MonadST s m => MonadST s (StateT u 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 (ReaderT r m) Source # | |
MonadST s m => MonadST s (ContT r m) Source # | |
The strict state-transformer monad.
A computation of type
transforms an internal state indexed
by ST
s as
, and returns a value of type a
.
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 # | |
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 |
MonadThrow (ST s) | |
Defined in Control.Monad.Catch | |
PrimMonad (ST s) | |
PrimBase (ST s) | |
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 |
Strict (ST s a) (ST s a) | |
type PrimState (ST s) | |
Defined in Control.Monad.Primitive |
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#
.