Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Tested with: GHC 8.0.1
The module defines the Simulation
monad that represents a computation within
the simulation run.
- data Simulation a
- class SimulationLift m where
- runSimulation :: Simulation a -> Specs -> IO a
- runSimulations :: Simulation a -> Specs -> Int -> [IO a]
- runSimulationByIndex :: Simulation a -> Specs -> Int -> Int -> IO a
- catchSimulation :: Exception e => Simulation a -> (e -> Simulation a) -> Simulation a
- finallySimulation :: Simulation a -> Simulation b -> Simulation a
- throwSimulation :: Exception e => e -> Simulation a
- memoSimulation :: Simulation a -> Simulation (Simulation a)
- data SimulationException = Exception e => SimulationException e
- data SimulationAbort = SimulationAbort String
- data SimulationRetry = SimulationRetry String
Simulation
data Simulation a Source #
A value in the Simulation
monad represents a computation
within the simulation run.
Monad Simulation Source # | |
Functor Simulation Source # | |
MonadFix Simulation Source # | |
Applicative Simulation Source # | |
MonadIO Simulation Source # | |
MonadThrow Simulation Source # | |
MonadCatch Simulation Source # | |
MonadMask Simulation Source # | |
ParameterLift Simulation Source # | |
SimulationLift Simulation Source # | |
ResultComputing Simulation Source # | |
ResultItemable (ResultValue a) => ResultProvider (Simulation a) Source # | |
(Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Simulation (Array i e)) Source # | |
ResultItemable (ResultValue [e]) => ResultProvider (Simulation (Vector e)) Source # | |
(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Simulation (TimingCounter a)) Source # | |
(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Simulation (SamplingCounter a)) Source # | |
class SimulationLift m where Source #
A type class to lift the simulation computations to other computations.
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
.
:: 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 SimulationException Source #
The root of simulation exceptions.
Exception e => SimulationException e | A particular simulation exception. |
data SimulationAbort Source #
An exception that signals of aborting the simulation.
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.
SimulationRetry String | The exception to retry the computation. |