what4-1.6.3: Solver-agnostic symbolic values support for issuing queries

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.

Synopsis

- class Monad m => MonadST s (m :: Type -> Type) | m -> s where
  - liftST :: ST s a -> m a
- data ST s a
- data RealWorld

# Documentation

class Monad m => MonadST s (m :: Type -> Type) | m -> s where Source #

Methods

liftST :: ST s a -> m a Source #

#### Instances

Instances details

MonadST RealWorld IO Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST RealWorld a -> IO a Source #
MonadST s (ST s) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> ST s a Source #
MonadST s m => MonadST s (ReaderT r m) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> ReaderT r m a Source #
MonadST s m => MonadST s (StateT u m) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> StateT u m a Source #
MonadST s m => MonadST s (StateT u m) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> StateT u m a Source #
(MonadST s m, Monoid w) => MonadST s (WriterT w m) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> WriterT w m a Source #
(MonadST s m, Monoid w) => MonadST s (WriterT w m) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> WriterT w m a Source #
MonadST s (VarRecorder s t) Source # |
Instance details Defined in What4.Expr.VarIdentification Methods liftST :: ST s a -> VarRecorder s t a Source #
MonadST s m => MonadST s (ContT r m) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> ContT r m a Source #

data ST s a Source #

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

- an uninstantiated type variable (inside invocations of `runST`), or
- `RealWorld` (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) = _|_

#### Instances

Instances details

MonadST s (ST s) Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST s a -> ST s a Source #
MonadThrow (ST s) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> ST s a Source #
Applicative (ST s) | Since: base-4.4.0.0
Instance details Defined in GHC.Internal.ST Methods pure :: a -> ST s a Source # (<*>) :: ST s (a -> b) -> ST s a -> ST s b Source # liftA2 :: (a -> b -> c) -> ST s a -> ST s b -> ST s c Source # (*>) :: ST s a -> ST s b -> ST s b Source # (<*) :: ST s a -> ST s b -> ST s a Source #
Functor (ST s) | Since: base-2.1
Instance details Defined in GHC.Internal.ST Methods fmap :: (a -> b) -> ST s a -> ST s b Source # (<$) :: a -> ST s b -> ST s a Source #
Monad (ST s) | Since: base-2.1
Instance details Defined in GHC.Internal.ST Methods (>>=) :: ST s a -> (a -> ST s b) -> ST s b Source # (>>) :: ST s a -> ST s b -> ST s b Source # return :: a -> ST s a Source #
MonadFix (ST s) | Since: base-2.1
Instance details Defined in GHC.Internal.Control.Monad.Fix Methods mfix :: (a -> ST s a) -> ST s a Source #
PrimBase (ST s) |
Instance details Defined in Control.Monad.Primitive Methods internal :: ST s a -> State# (PrimState (ST s)) -> (# State# (PrimState (ST s)), a #)
PrimMonad (ST s) |

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ST s) |
Instance details Defined in Control.Monad.Primitive type PrimState (ST s) = s

Methods

primitive :: (State# (PrimState (ST s)) -> (# State# (PrimState (ST s)), a #)) -> ST s a

RandomGen g => FrozenGen (STGen g) (ST s) |

Instance details

Defined in System.Random.Stateful

Associated Types

type MutableGen (STGen g) (ST s) |
Instance details Defined in System.Random.Stateful type MutableGen (STGen g) (ST s) = STGenM g s

Methods

freezeGen :: MutableGen (STGen g) (ST s) -> ST s (STGen g)

thawGen :: STGen g -> ST s (MutableGen (STGen g) (ST s))

Monoid a => Monoid (ST s a) | Since: base-4.11.0.0
Instance details Defined in GHC.Internal.ST Methods mempty :: ST s a Source # mappend :: ST s a -> ST s a -> ST s a Source # mconcat :: [ST s a] -> ST s a Source #
Semigroup a => Semigroup (ST s a) | Since: base-4.11.0.0
Instance details Defined in GHC.Internal.ST Methods (<>) :: ST s a -> ST s a -> ST s a Source # sconcat :: NonEmpty (ST s a) -> ST s a Source # stimes :: Integral b => b -> ST s a -> ST s a Source #
Show (ST s a) | Since: base-2.1
Instance details Defined in GHC.Internal.ST Methods showsPrec :: Int -> ST s a -> ShowS Source # show :: ST s a -> String Source # showList :: [ST s a] -> ShowS Source #
RandomGen r => RandomGenM (STGenM r s) r (ST s) |
Instance details Defined in System.Random.Stateful Methods applyRandomGenM :: (r -> (a, r)) -> STGenM r s -> ST s a
RandomGen g => StatefulGen (STGenM g s) (ST s) |

Instance details

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) |
Instance details Defined in Control.Monad.Primitive type PrimState (ST s) = s
type MutableGen (STGen g) (ST s) |
Instance details Defined in System.Random.Stateful type MutableGen (STGen g) (ST s) = STGenM g s

data RealWorld Source #

`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#`.

#### Instances

Instances details

MonadST RealWorld IO Source # |
Instance details Defined in What4.Utils.MonadST Methods liftST :: ST RealWorld a -> IO a Source #