Stability | experimental |
---|---|
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Safe Haskell | Safe-Inferred |
Tested with: GHC 7.6.3
The module defines the Simulation
monad that represents a simulation run.
- data Simulation a
- class Monad m => SimulationLift m where
- liftSimulation :: Simulation a -> m a
- runSimulation :: Simulation a -> Specs -> IO a
- runSimulations :: Simulation a -> Specs -> Int -> [IO a]
- catchSimulation :: Simulation a -> (IOException -> Simulation a) -> Simulation a
- finallySimulation :: Simulation a -> Simulation b -> Simulation a
- throwSimulation :: IOException -> Simulation a
- simulationIndex :: Simulation Int
- simulationCount :: Simulation Int
- simulationSpecs :: Simulation Specs
Simulation
data Simulation a Source
A value in the Simulation
monad represents something that
doesn't change within the simulation run but may change for
other runs.
This monad is ideal for representing the external parameters for the model, when the Monte-Carlo simulation is used. Also this monad is useful for defining some actions that should occur only once within the simulation run, for example, setting of the integral with help of recursive equations.
Monad Simulation | |
Functor Simulation | |
MonadFix Simulation | |
MonadIO Simulation | |
SimulationLift Simulation | |
Eq (Simulation a) | |
Floating a => Floating (Simulation a) | |
Fractional a => Fractional (Simulation a) | |
Num a => Num (Simulation a) | |
Show (Simulation a) |
class Monad m => SimulationLift m whereSource
A type class to lift the simulation computations to other monads.
liftSimulation :: Simulation a -> m aSource
Lift the specified Simulation
computation to another monad.
runSimulation :: Simulation a -> Specs -> IO aSource
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
.
Error Handling
catchSimulation :: Simulation a -> (IOException -> Simulation a) -> Simulation aSource
Exception handling within Simulation
computations.
finallySimulation :: Simulation a -> Simulation b -> Simulation aSource
A computation with finalization part like the finally
function.
throwSimulation :: IOException -> Simulation aSource
Like the standard throw
function.
Utilities
simulationIndex :: Simulation IntSource
Return the run index for the current simulation.
simulationCount :: Simulation IntSource
Return the number of simulations currently run.
simulationSpecs :: Simulation SpecsSource
Return the simulation specs.