aivika-branches-0.2: Nested discrete event simulation module for the Aivika library

CopyrightCopyright (c) 2016-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Simulation.Aivika.Branch.Event

Contents

Description

Tested with: GHC 7.10.3

The module defines an event queue, where BR can be an instance of EventQueueing. Also it defines basic functions for branching computations.

Synopsis

Documentation

branchEvent :: Event (BR IO) a -> Event (BR IO) 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 (BR IO) a -> Event (BR IO) 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 (BR IO) a -> Event (BR IO) a Source #

Like futureEvent but allows specifying how the pending events must be processed.

Orphan instances

EventQueueing (BR IO) Source #

An implementation of the EventQueueing type class.

Associated Types

data EventQueue (BR IO :: * -> *) :: * #