Stability | experimental |
---|---|
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Safe Haskell | Safe-Inferred |
Tested with: GHC 7.6.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 can involve the Event
, Dynamics
and Simulation
computations. Moreover, a value in the Process
monad can be run within
the Event
computation.
A value of the ProcessId
type is just an identifier of such a process.
- data ProcessId
- data Process a
- runProcess :: ProcessId -> Process () -> Event ()
- runProcessInStartTime :: EventProcessing -> ProcessId -> Process () -> Simulation ()
- runProcessInStopTime :: EventProcessing -> ProcessId -> Process () -> Simulation ()
- enqueueProcess :: Double -> ProcessId -> Process () -> Event ()
- enqueueProcessWithStartTime :: ProcessId -> Process () -> Event ()
- enqueueProcessWithStopTime :: ProcessId -> Process () -> Event ()
- newProcessId :: Simulation ProcessId
- newProcessIdWithCatch :: Simulation ProcessId
- processId :: Process ProcessId
- holdProcess :: Double -> Process ()
- interruptProcess :: ProcessId -> Event ()
- processInterrupted :: ProcessId -> Event Bool
- passivateProcess :: Process ()
- processPassive :: ProcessId -> Event Bool
- reactivateProcess :: ProcessId -> Event ()
- cancelProcess :: ProcessId -> Event ()
- processCanceled :: ProcessId -> Event Bool
- catchProcess :: Process a -> (IOException -> Process a) -> Process a
- finallyProcess :: Process a -> Process b -> Process a
- throwProcess :: IOException -> Process a
Documentation
Specifies a discontinuous process that can suspend at any time and then resume later.
runProcess :: ProcessId -> Process () -> Event ()Source
Start immediately the process with the specified identifier.
To run the process at the specified time, you can use
the enqueueProcess
function.
runProcessInStartTime :: EventProcessing -> ProcessId -> Process () -> Simulation ()Source
Start the process in the start time immediately.
runProcessInStopTime :: EventProcessing -> ProcessId -> Process () -> Simulation ()Source
Start the process in the stop time immediately.
enqueueProcess :: Double -> ProcessId -> Process () -> Event ()Source
Enqueue the process that will be then started at the specified time from the event queue.
enqueueProcessWithStartTime :: ProcessId -> Process () -> Event ()Source
Enqueue the process that will be then started in the start time from the event queue.
enqueueProcessWithStopTime :: ProcessId -> Process () -> Event ()Source
Enqueue the process that will be then started in the stop time from the event queue.
newProcessId :: Simulation ProcessIdSource
Create a new process identifier without exception handling.
newProcessIdWithCatch :: Simulation ProcessIdSource
Create a new process identifier 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 -> Event ()Source
Interrupt a process with the specified identifier if the process
is held by computation holdProcess
.
processInterrupted :: ProcessId -> Event BoolSource
Test whether the process with the specified identifier was interrupted.
passivateProcess :: Process ()Source
Passivate the process.
processPassive :: ProcessId -> Event BoolSource
Test whether the process with the specified identifier is passivated.
reactivateProcess :: ProcessId -> Event ()Source
Reactivate a process with the specified identifier.
cancelProcess :: ProcessId -> Event ()Source
Cancel a process with the specified identifier.
processCanceled :: ProcessId -> Event BoolSource
Test whether the process with the specified identifier was canceled.
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.