aivika-transformers-4.5: Transformers for the Aivika simulation library

Simulation.Aivika.Trans.Simulation

Description

Tested with: GHC 8.0.1

The module defines the Simulation monad transformer that represents a simulation run.

Synopsis

# Simulation

data Simulation m a Source #

A value in the Simulation monad represents a computation within the simulation run.

Instances

 Source # MethodsliftSimulation :: Simulation m a -> Simulation m a Source # Source # MethodscomputeResultData :: Simulation m a -> ResultData a m Source #

class SimulationLift t m where Source #

A type class to lift the simulation computations into other computations.

Minimal complete definition

liftSimulation

Methods

liftSimulation :: Simulation m a -> t m a Source #

Lift the specified Simulation computation into another computation.

Instances

 Source # MethodsliftSimulation :: Simulation m a -> Simulation m a Source # Source # MethodsliftSimulation :: Simulation m a -> Cont m a Source # Source # MethodsliftSimulation :: Simulation m a -> Process m a Source #

runSimulation :: MonadDES m => Simulation m a -> Specs m -> m a Source #

Run the simulation using the specified specs.

runSimulations :: MonadDES m => Simulation m a -> Specs m -> Int -> [m a] Source #

Run the given number of simulations using the specified specs, where each simulation is distinguished by its index simulationIndex.

Arguments

 :: MonadDES m => Simulation m a the simulation model -> Specs m the simulation specs -> Int the number of runs in series -> Int the index of the current run (started from 1) -> m a

Run the simulation by the specified specs and run index in series.

# Error Handling

catchSimulation :: (MonadException m, Exception e) => Simulation m a -> (e -> Simulation m a) -> Simulation m a Source #

Exception handling within Simulation computations.

finallySimulation :: MonadException m => Simulation m a -> Simulation m b -> Simulation m a Source #

A computation with finalization part like the finally function.

throwSimulation :: (MonadException m, Exception e) => e -> Simulation m a Source #

Like the standard throw function.

# Exceptions

data SimulationException :: * where #

The root of simulation exceptions.

Constructors

 SimulationException :: SimulationException A particular simulation exception.

Instances

 Methods Methods

data SimulationAbort :: * #

An exception that signals of aborting the simulation.

Constructors

 SimulationAbort String The exception to abort the simulation.

Instances

 MethodsshowList :: [SimulationAbort] -> ShowS # Methods

data SimulationRetry :: * #

An exception that signals that the current computation should be retried as possible, which feature may be supported by the simulation engine or not.

Constructors

 SimulationRetry String The exception to retry the computation.

Instances

 MethodsshowList :: [SimulationRetry] -> ShowS # Methods