aivika-6.1: A multi-method simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Ref

Description

Tested with: GHC 8.0.1

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 dependent on the event queue, which allows synchronizing the reference with the model explicitly through the Event monad.

Instances

Instances details
ResultComputing Ref Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Ref (SamplingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Ref (TimingCounter a)) Source # 
Instance details

Defined in Simulation.Aivika.Results

(Ix i, Show i, ResultItemable (ResultValue [e])) => ResultProvider (Ref (Array i e)) Source # 
Instance details

Defined in Simulation.Aivika.Results

ResultItemable (ResultValue [e]) => ResultProvider (Ref (Vector e)) Source # 
Instance details

Defined in Simulation.Aivika.Results

ResultItemable (ResultValue a) => ResultProvider (Ref a) Source # 
Instance details

Defined in Simulation.Aivika.Results

refChanged :: Ref a -> Signal a Source #

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 :: a -> Simulation (Ref a) Source #

Create a new reference.

readRef :: Ref a -> Event a Source #

Read the value of a reference.

writeRef :: Ref a -> a -> Event () Source #

Write a new value into the reference.

modifyRef :: Ref a -> (a -> a) -> Event () Source #

Mutate the contents of the reference.