aivika-0.3: A multi-paradigm simulation library

MaintainerDavid Sorokin <>
Safe HaskellSafe-Infered



Tested with: GHC 7.0.3

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



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.

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.