aivika-0.4.1: A multi-paradigm simulation library

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

Simulation.Aivika.Dynamics.Ref

Description

Tested with: GHC 7.0.3

This module defines an updatable reference that depends on the event queue.

Synopsis

Documentation

data Ref a Source

The Ref type represents a mutable variable similar to the IORef variable but only bound to some event queue, which makes the variable coordinated with that queue.

refQueue :: Ref a -> EventQueueSource

Return the bound event queue.

refChanged :: Ref a -> Signal aSource

Return a signal that notifies about every change of the reference state.

refChanged_ :: Ref a -> Signal ()Source

Return a signal that notifies about every change of the reference state.

newRef :: EventQueue -> a -> Simulation (Ref a)Source

Create a new reference bound to the specified event queue.

readRef :: Ref a -> Dynamics aSource

Read the value of a reference, forcing the bound event queue to raise the events in case of need.

writeRef :: Ref a -> a -> Dynamics ()Source

Write a new value into the reference.

modifyRef :: Ref a -> (a -> a) -> Dynamics ()Source

Mutate the contents of the reference, forcing the bound event queue to raise all pending events in case of need.