aivika-5.9.1: A multi-method simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

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

Instances details
Monad Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

(>>=) :: Simulation a -> (a -> Simulation b) -> Simulation b #

(>>) :: Simulation a -> Simulation b -> Simulation b #

return :: a -> Simulation a #

Functor Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

fmap :: (a -> b) -> Simulation a -> Simulation b #

(<$) :: a -> Simulation b -> Simulation a #

MonadFix Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

mfix :: (a -> Simulation a) -> Simulation a #

MonadFail Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

fail :: String -> Simulation a #

Applicative Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

pure :: a -> Simulation a #

(<*>) :: Simulation (a -> b) -> Simulation a -> Simulation b #

liftA2 :: (a -> b -> c) -> Simulation a -> Simulation b -> Simulation c #

(*>) :: Simulation a -> Simulation b -> Simulation b #

(<*) :: Simulation a -> Simulation b -> Simulation a #

MonadIO Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

liftIO :: IO a -> Simulation a #

MonadThrow Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

throwM :: Exception e => e -> Simulation a #

MonadCatch Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

catch :: Exception e => Simulation a -> (e -> Simulation a) -> Simulation a #

MonadMask Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

Methods

mask :: ((forall a. Simulation a -> Simulation a) -> Simulation b) -> Simulation b #

uninterruptibleMask :: ((forall a. Simulation a -> Simulation a) -> Simulation b) -> Simulation b #

generalBracket :: Simulation a -> (a -> ExitCase b -> Simulation c) -> (a -> Simulation b) -> Simulation (b, c) #

ParameterLift Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

SimulationLift Simulation Source # 
Instance details

Defined in Simulation.Aivika.Internal.Simulation

ResultComputing Simulation Source # 
Instance details

Defined in Simulation.Aivika.Results

ResultItemable (ResultValue a) => ResultProvider (Simulation a) Source # 
Instance details

Defined in Simulation.Aivika.Results

(Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Simulation (Array i e)) Source # 
Instance details

Defined in Simulation.Aivika.Results

ResultItemable (ResultValue [e]) => ResultProvider (Simulation (Vector e)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Simulation (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Simulation (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

class SimulationLift m where Source #

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

Methods

liftSimulation :: Simulation a -> m a Source #

Lift the specified Simulation computation to another computation.

runSimulation :: Simulation a -> Specs -> IO a Source #

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.

runSimulationByIndex Source #

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.

finallySimulation :: Simulation a -> Simulation b -> Simulation a Source #

A computation with finalization part like the finally function.

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

Like the standard throw function.

Memoization

memoSimulation :: Simulation a -> Simulation (Simulation a) Source #

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

Exceptions

data SimulationAbort Source #

An exception that signals of aborting the simulation.

Constructors

SimulationAbort String

The exception to abort the simulation.

data SimulationRetry Source #

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.