qute-0.1.0: A software analysis framework built around the QBE intermediate language.
Safe HaskellNone
LanguageGHC2021

Language.QBE.Simulator.Default.State

Synopsis

Interpreter State

data Env v b Source #

Instances

Instances details
MonadState (Env v b) (SimState v b) Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

get :: SimState v b (Env v b) #

put :: Env v b -> SimState v b () #

state :: (Env v b -> (a, Env v b)) -> SimState v b a #

mkEnv :: (Storable v b, ValueRepr v) => Program -> Address -> Size -> IO (Env v b) Source #

initData :: (Storable v b, ValueRepr v) => DataMem -> StateT (Env v b) IO () Source #

storeValues :: Storable v b => Address -> [v] -> StateT (Env v b) IO Address Source #

State Monad

newtype SimState v b a Source #

Simulator state, parameterized over a value and byte representation.

Constructors

SimState 

Fields

Instances

Instances details
MonadError EvalError (SimState v b) Source #

Implements MonadError in SimState via IOExceptions. This should be more performant than using ExceptT monad transformer in conjunction with StateT.

Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

throwError :: EvalError -> SimState v b a #

catchError :: SimState v b a -> (EvalError -> SimState v b a) -> SimState v b a #

MonadIO (SimState v b) Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

liftIO :: IO a -> SimState v b a #

Applicative (SimState v b) Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

pure :: a -> SimState v b a #

(<*>) :: SimState v b (a -> b0) -> SimState v b a -> SimState v b b0 #

liftA2 :: (a -> b0 -> c) -> SimState v b a -> SimState v b b0 -> SimState v b c #

(*>) :: SimState v b a -> SimState v b b0 -> SimState v b b0 #

(<*) :: SimState v b a -> SimState v b b0 -> SimState v b a #

Functor (SimState v b) Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

fmap :: (a -> b0) -> SimState v b a -> SimState v b b0 #

(<$) :: a -> SimState v b b0 -> SimState v b a #

Monad (SimState v b) Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

(>>=) :: SimState v b a -> (a -> SimState v b b0) -> SimState v b b0 #

(>>) :: SimState v b a -> SimState v b b0 -> SimState v b b0 #

return :: a -> SimState v b a #

(Storable v b, ValueRepr v, NFData b) => Simulator (SimState v b) v Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

MonadState (Env v b) (SimState v b) Source # 
Instance details

Defined in Language.QBE.Simulator.Default.State

Methods

get :: SimState v b (Env v b) #

put :: Env v b -> SimState v b () #

state :: (Env v b -> (a, Env v b)) -> SimState v b a #

unliftCatch :: Exception t => StateT s IO a -> (t -> StateT s IO a) -> StateT s IO a Source #

Unlift IOException handling into a generic StateT monad.

See also: https://hackage.haskell.org/package/unliftio.

run :: (ValueRepr v, Storable v b) => Env v b -> SimState v b a -> IO a Source #