UMinho Haskell Libraries (1.0)ContentsIndex
Camila.State
Portability experimental
Stability experimental
Maintainer João Ferreira, Alexandra Mendes
Description
Module that defines State structure. It uses State Monad.
Synopsis
type InterpState a = ST CamilaState a
type Instances = FiniteMap String (String, Dynamic)
execute :: Show a => ST CamilaState a -> IO ()
preOn :: InterpState ()
preOff :: InterpState ()
dtinvOn :: InterpState ()
dtinvOff :: InterpState ()
checkDTInv :: CamilaState -> Bool
checkPre :: CamilaState -> Bool
instances :: CamilaState -> Instances
data CamilaState
camilaInitial :: CamilaState
getTypeAsString :: String -> InterpState String
addToInstances :: Instances -> InterpState ()
getInstance :: String -> Instances -> CamilaError Dynamic
setState :: String -> (String, Dynamic) -> InterpState ()
liftE :: (MonadError e (ErrorT e m), Monad m) => Either e a -> ErrorT e m a
runInstance :: Show a => ST ivars a -> ivars -> IO (CamilaError a)
type ST ivars a = ErrorT CamilaError' (StateT ivars IO) a
create :: Typeable a => String -> String -> a -> InterpState Instances
getId :: String -> InterpState Dynamic
Documentation
type InterpState a = ST CamilaState a
Monad instantiated with the interpreter state.
type Instances = FiniteMap String (String, Dynamic)
The type of an instances store.
execute :: Show a => ST CamilaState a -> IO ()
Execute a computation that delivers a showable type.
preOn :: InterpState ()
Turn on precondition checking.
preOff :: InterpState ()
Turn off precondition checking.
dtinvOn :: InterpState ()
Turn on data type invariant checking.
dtinvOff :: InterpState ()
Turn off data type invariant checking.
checkDTInv :: CamilaState -> Bool
Not used, currently
checkPre :: CamilaState -> Bool
Not used, currently
instances :: CamilaState -> Instances
data CamilaState
The type of the Camila interpreter state. It holds a map from instance references to instances.
camilaInitial :: CamilaState
The initial state of the interpreter.
getTypeAsString
:: StringInstance identifier.
-> InterpState String
Returns the class name of an instance.
addToInstances :: Instances -> InterpState ()
Add several instances to the current store.
getInstance
:: StringInstance identifier.
-> InstancesThe instance store.
-> CamilaError Dynamic
Retrieve an instance from a given store.
setState
:: StringInstance identifier.
-> (String, Dynamic)Pair of class name and object.
-> InterpState ()
Add an instance to the current store.
liftE :: (MonadError e (ErrorT e m), Monad m) => Either e a -> ErrorT e m a
Lift an Either term into the error monad.
runInstance
:: Show a
=> ST ivars aComputation.
-> ivarsInitial state
-> IO (CamilaError a)
Perform a given operation on a given initial state.
type ST ivars a = ErrorT CamilaError' (StateT ivars IO) a
Monad that combines all needed interpreter effects.
create
:: Typeable a
=> StringInstance identifier
-> StringClass name
-> aInitial state of the instance
-> InterpState Instances
Create a new instance.
getId
:: StringInstance identifier.
-> InterpState Dynamic
Retrieve an instance from the store.
Produced by Haddock version 0.6