aivika-transformers-6.1: Transformers for the Aivika simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.Internal.Simulation

Description

Tested with: GHC 8.0.1

The module defines the Simulation monad transformer that represents a computation within the simulation run.

Synopsis

Simulation

newtype Simulation m a Source #

A value in the Simulation monad represents a computation within the simulation run.

Constructors

Simulation (Run m -> m a) 

Instances

Instances details
MonadTrans Simulation Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

lift :: Monad m => m a -> Simulation m a #

Monad m => MonadCompTrans Simulation m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

liftComp :: m a -> Simulation m a Source #

Monad m => ParameterLift Simulation m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Monad m => SimulationLift Simulation m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

MonadDES m => ResultComputing Simulation m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Results

Monad m => MonadFail (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

fail :: String -> Simulation m a #

MonadFix m => MonadFix (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

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

MonadIO m => MonadIO (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

liftIO :: IO a -> Simulation m a #

Applicative m => Applicative (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

pure :: a -> Simulation m a #

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

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

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

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

Functor m => Functor (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

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

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

Monad m => Monad (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

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

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

return :: a -> Simulation m a #

MonadException m => MonadCatch (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

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

(MonadException m, MonadMask m) => MonadMask (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

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

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

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

MonadException m => MonadThrow (Simulation m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Internal.Simulation

Methods

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

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

Defined in Simulation.Aivika.Trans.Results

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

Defined in Simulation.Aivika.Trans.Results

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

Defined in Simulation.Aivika.Trans.Results

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

Defined in Simulation.Aivika.Trans.Results

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

Defined in Simulation.Aivika.Trans.Results

class SimulationLift t m where Source #

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

Methods

liftSimulation :: Simulation m a -> t m a Source #

Lift the specified Simulation computation into another computation.

invokeSimulation :: Run m -> Simulation m a -> m a Source #

Invoke the Simulation computation.

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.

runSimulationByIndex Source #

Arguments

:: 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 SimulationAbort #

An exception that signals of aborting the simulation.

Constructors

SimulationAbort String

The exception to abort the simulation.

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.

Constructors

SimulationRetry String

The exception to retry the computation.

Orphan instances

MonadTrans Simulation Source # 
Instance details

Methods

lift :: Monad m => m a -> Simulation m a #

Monad m => MonadCompTrans Simulation m Source # 
Instance details

Methods

liftComp :: m a -> Simulation m a Source #

Monad m => ParameterLift Simulation m Source # 
Instance details

Monad m => MonadFail (Simulation m) Source # 
Instance details

Methods

fail :: String -> Simulation m a #

MonadFix m => MonadFix (Simulation m) Source # 
Instance details

Methods

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

MonadIO m => MonadIO (Simulation m) Source # 
Instance details

Methods

liftIO :: IO a -> Simulation m a #

Applicative m => Applicative (Simulation m) Source # 
Instance details

Methods

pure :: a -> Simulation m a #

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

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

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

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

Functor m => Functor (Simulation m) Source # 
Instance details

Methods

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

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

Monad m => Monad (Simulation m) Source # 
Instance details

Methods

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

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

return :: a -> Simulation m a #

MonadException m => MonadCatch (Simulation m) Source # 
Instance details

Methods

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

(MonadException m, MonadMask m) => MonadMask (Simulation m) Source # 
Instance details

Methods

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

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

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

MonadException m => MonadThrow (Simulation m) Source # 
Instance details

Methods

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