Copyright | Copyright (c) 2009-2013, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Tested with: GHC 7.8.3
The module defines the Simulation
monad that represents a simulation run.
- data Simulation a
- class 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
- memoSimulation :: Simulation a -> Simulation (Simulation a)
Simulation
data Simulation a Source
A value in the Simulation
monad represents a computation
within the simulation run.
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
.
Error Handling
catchSimulation :: Simulation a -> (IOException -> 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 :: IOException -> 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.