aivika-4.5: A multi-method simulation library

Simulation.Aivika.Simulation

Description

Tested with: GHC 8.0.1

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

Synopsis

# Simulation

data Simulation a Source #

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

Instances

 Source # Methods(>>=) :: Simulation a -> (a -> Simulation b) -> Simulation b #(>>) :: Simulation a -> Simulation b -> Simulation b #return :: a -> Simulation a # Source # Methodsfmap :: (a -> b) -> Simulation a -> Simulation b #(<\$) :: a -> Simulation b -> Simulation a # Source # Methodsmfix :: (a -> Simulation a) -> Simulation a # Source # Methodspure :: a -> Simulation a #(<*>) :: Simulation (a -> b) -> Simulation a -> Simulation b #(*>) :: Simulation a -> Simulation b -> Simulation b #(<*) :: Simulation a -> Simulation b -> Simulation a # Source # MethodsliftIO :: IO a -> Simulation a # Source # Methods Source # Methods Source # Methods

class SimulationLift m where Source #

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

Minimal complete definition

liftSimulation

Methods

liftSimulation :: Simulation a -> m a Source #

Lift the specified Simulation computation to another computation.

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods

Run the simulation using the specified specs.

runSimulations :: Simulation a -> Specs -> Int -> [IO a] Source #

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

Arguments

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

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

# Error Handling

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

Exception handling within Simulation computations.

A computation with finalization part like the finally function.

throwSimulation :: Exception e => e -> Simulation a Source #

Like the standard throw function.

# Memoization

Memoize the Simulation computation, always returning the same value within a simulation run.

# Exceptions

The root of simulation exceptions.

Constructors

 Exception e => SimulationException e A particular simulation exception.

Instances

 Source # Methods Source # Methods

An exception that signals of aborting the simulation.

Constructors

 SimulationAbort String The exception to abort the simulation.

Instances

 Source # MethodsshowList :: [SimulationAbort] -> ShowS # Source # Methods

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

 Source # MethodsshowList :: [SimulationRetry] -> ShowS # Source # Methods