aivika-0.4: A multi-paradigm simulation library

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

Simulation.Aivika.Dynamics.UVar

Description

Tested with: GHC 7.0.3

This module defines a variable that is bound to the event queue and that keeps the history of changes storing the values in an unboxed array.

Synopsis

Documentation

data UVar a Source

A version of the Var type which uses an unboxed array to store the values in time points. You should prefer this type whenever possible.

uvarQueue :: UVar a -> EventQueueSource

Return the bound event queue.

uvarChanged :: UVar a -> Signal aSource

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

uvarChanged_ :: UVar a -> Signal ()Source

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

newUVar :: MArray IOUArray a IO => EventQueue -> a -> Simulation (UVar a)Source

Create a new variable bound to the specified event queue.

readUVar :: MArray IOUArray a IO => UVar a -> Dynamics aSource

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

writeUVar :: MArray IOUArray a IO => UVar a -> a -> Dynamics ()Source

Write a new value into the variable.

modifyUVar :: MArray IOUArray a IO => UVar a -> (a -> a) -> Dynamics ()Source

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

freezeUVar :: MArray IOUArray a IO => UVar a -> Dynamics (Array Int Double, Array Int a)Source

Freeze the variable and return in arrays the time points and corresponded values when the variable had changed.