aivika-0.4.3: A multi-paradigm simulation library

Stabilityexperimental
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Safe HaskellNone

Simulation.Aivika.Dynamics.Process

Description

Tested with: GHC 7.0.3

A value in the Process monad represents a discontinuous process that can suspend in any simulation time point and then resume later in the same or another time point.

The process of this type behaves like a dynamic process too. So, any value in the Dynamics monad can be lifted to the Process monad. Moreover, a value in the Process monad can be run in the Dynamics monad.

A value of the ProcessID type is just an identifier of such a process.

Synopsis

Documentation

data ProcessID Source

Represents a process identificator.

Instances

data Process a Source

Specifies a discontinuous process that can suspend at any time and then resume later.

processQueue :: ProcessID -> EventQueueSource

Return the event queue.

newProcessID :: EventQueue -> Simulation ProcessIDSource

Create a new process ID without exception handling.

newProcessIDWithCatch :: EventQueue -> Simulation ProcessIDSource

Create a new process ID with capabilities of catching the IOError exceptions and finalizing the computation. The corresponded process will be slower than that one which identifier is created with help of newProcessID.

holdProcess :: Double -> Process ()Source

Hold the process for the specified time period.

interruptProcess :: ProcessID -> Dynamics ()Source

Interrupt a process with the specified ID if the process was held by computation holdProcess.

processInterrupted :: ProcessID -> Dynamics BoolSource

Test whether the process with the specified ID was interrupted.

passivateProcess :: Process ()Source

Passivate the process.

processPassive :: ProcessID -> Dynamics BoolSource

Test whether the process with the specified ID is passivated.

reactivateProcess :: ProcessID -> Dynamics ()Source

Reactivate a process with the specified ID.

processID :: Process ProcessIDSource

Return the current process ID.

cancelProcess :: ProcessID -> Dynamics ()Source

Cancel a process with the specified ID.

processCanceled :: ProcessID -> Dynamics BoolSource

Test whether the process with the specified ID is canceled.

runProcess :: Process () -> ProcessID -> Double -> Dynamics ()Source

Start the process with the specified ID at the desired time.

runProcessNow :: Process () -> ProcessID -> Dynamics ()Source

Start the process with the specified ID at the current simulation time.

catchProcess :: Process a -> (IOException -> Process a) -> Process aSource

Exception handling within Process computations.

finallyProcess :: Process a -> Process b -> Process aSource

A computation with finalization part.

throwProcess :: IOException -> Process aSource

Throw the exception with the further exception handling. By some reasons, the standard throw function per se is not handled properly within Process computations, although it will be still handled if it will be hidden under the liftIO function. The problem arises namely with the throw function, not IO computations.