Copyright | Copyright (c) 2016, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Tested with: GHC 7.10.3
The module defines an event queue, where BrIO
is an instance of EventQueueing
.
Also it defines basic functions for branching computations.
- branchEvent :: Event BrIO a -> Event BrIO a
- futureEvent :: Double -> Event BrIO a -> Event BrIO a
- futureEventWith :: EventProcessing -> Double -> Event BrIO a -> Event BrIO a
Documentation
branchEvent :: Event BrIO a -> Event BrIO a Source
Branch a new computation and return its result leaving the current computation intact.
A new derivative branch with branchLevel
increased by 1 is created at the current modeling time.
Then the result of the specified computation for the derivative branch is returned.
The state of the current computation including its event queue and mutable references Ref
remain intact. In some sense we copy the state of the model to the derivative branch and then
proceed with the derived simulation. The copying operation is relatively cheap.
futureEvent :: Double -> Event BrIO a -> Event BrIO a Source
Branch a new computation and return its result at the desired time in the future leaving the current computation intact.
A new derivative branch with branchLevel
increased by 1 is created at the current modeling time.
All pending events are processed till the specified time for that new branch. Then the result
of the specified computation for the derivative branch is returned.
The state of the current computation including its event queue and mutable references Ref
remain intact. In some sense we copy the state of the model to the derivative branch and then
proceed with the derived simulation. The copying operation is relatively cheap.
futureEventWith :: EventProcessing -> Double -> Event BrIO a -> Event BrIO a Source
Like futureEvent
but allows specifying how the pending events must be processed.