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 transformer that represents a simulation run.
Synopsis
- data Simulation m a
- class SimulationLift t m where
- liftSimulation :: Simulation m a -> t m a
- runSimulation :: MonadDES m => Simulation m a -> Specs m -> m a
- runSimulations :: MonadDES m => Simulation m a -> Specs m -> Int -> [m a]
- runSimulationByIndex :: MonadDES m => Simulation m a -> Specs m -> Int -> Int -> m a
- catchSimulation :: (MonadException m, Exception e) => Simulation m a -> (e -> Simulation m a) -> Simulation m a
- finallySimulation :: MonadException m => Simulation m a -> Simulation m b -> Simulation m a
- throwSimulation :: (MonadException m, Exception e) => e -> Simulation m a
- data SimulationException = Exception e => SimulationException e
- data SimulationAbort = SimulationAbort String
- data SimulationRetry = SimulationRetry String
Simulation
data Simulation m a Source #
A value in the Simulation
monad represents a computation
within the simulation run.
Instances
class SimulationLift t m where Source #
A type class to lift the simulation computations into other computations.
liftSimulation :: Simulation m a -> t m a Source #
Lift the specified Simulation
computation into another computation.
Instances
Monad m => SimulationLift Event m Source # | |
Defined in Simulation.Aivika.Trans.Internal.Event liftSimulation :: Simulation m a -> Event m a Source # | |
Monad m => SimulationLift Dynamics m Source # | |
Defined in Simulation.Aivika.Trans.Internal.Dynamics liftSimulation :: Simulation m a -> Dynamics m a Source # | |
Monad m => SimulationLift Simulation m Source # | |
Defined in Simulation.Aivika.Trans.Internal.Simulation liftSimulation :: Simulation m a -> Simulation m a Source # | |
Monad m => SimulationLift Composite m Source # | |
Defined in Simulation.Aivika.Trans.Composite liftSimulation :: Simulation m a -> Composite m a Source # | |
MonadDES m => SimulationLift Cont m Source # | |
Defined in Simulation.Aivika.Trans.Internal.Cont liftSimulation :: Simulation m a -> Cont m a Source # | |
MonadDES m => SimulationLift Process m Source # | |
Defined in Simulation.Aivika.Trans.Internal.Process liftSimulation :: Simulation m a -> Process m a Source # |
runSimulation :: MonadDES m => Simulation m a -> Specs m -> m a Source #
Run the simulation using the specified specs.
runSimulations :: MonadDES m => Simulation m a -> Specs m -> Int -> [m a] Source #
Run the given number of simulations using the specified specs,
where each simulation is distinguished by its index simulationIndex
.
:: MonadDES m | |
=> Simulation m a | the simulation model |
-> Specs m | the simulation specs |
-> Int | the number of runs in series |
-> Int | the index of the current run (started from 1) |
-> m a |
Run the simulation by the specified specs and run index in series.
Error Handling
catchSimulation :: (MonadException m, Exception e) => Simulation m a -> (e -> Simulation m a) -> Simulation m a Source #
Exception handling within Simulation
computations.
finallySimulation :: MonadException m => Simulation m a -> Simulation m b -> Simulation m a Source #
A computation with finalization part like the finally
function.
throwSimulation :: (MonadException m, Exception e) => e -> Simulation m a Source #
Like the standard throw
function.
Exceptions
data SimulationException #
The root of simulation exceptions.
Exception e => SimulationException e | A particular simulation exception. |
Instances
Show SimulationException | |
Defined in Simulation.Aivika.Internal.Simulation showsPrec :: Int -> SimulationException -> ShowS # show :: SimulationException -> String # showList :: [SimulationException] -> ShowS # | |
Exception SimulationException | |
data SimulationAbort #
An exception that signals of aborting the simulation.
SimulationAbort String | The exception to abort the simulation. |
Instances
Show SimulationAbort | |
Defined in Simulation.Aivika.Internal.Simulation showsPrec :: Int -> SimulationAbort -> ShowS # show :: SimulationAbort -> String # showList :: [SimulationAbort] -> ShowS # | |
Exception SimulationAbort | |
data SimulationRetry #
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. |
Instances
Show SimulationRetry | |
Defined in Simulation.Aivika.Internal.Simulation showsPrec :: Int -> SimulationRetry -> ShowS # show :: SimulationRetry -> String # showList :: [SimulationRetry] -> ShowS # | |
Exception SimulationRetry | |