aivika-transformers-5.5: Transformers for the Aivika simulation library

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

Simulation.Aivika.Trans.Ref

Description

Tested with: GHC 8.0.1

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

Synopsis

Documentation

data Ref m 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

MonadDES m => ResultComputing Ref m Source # 
(MonadDES m, Observable (Ref m) (t m)) => Observable (Ref m) (t m) Source # 

Methods

readObservable :: Ref m a -> t m a Source #

MonadDES m => Eq (Ref m a) Source # 

Methods

(==) :: Ref m a -> Ref m a -> Bool #

(/=) :: Ref m a -> Ref m a -> Bool #

(MonadDES m, ResultItemable (ResultValue [e])) => ResultProvider (Ref m (Vector e)) m Source # 
(Ix i, Show i, MonadDES m, ResultItemable (ResultValue [e])) => ResultProvider (Ref m (Array i e)) m Source # 
(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (TimingStats a))) => ResultProvider (Ref m (TimingCounter a)) m Source # 
(MonadDES m, ResultItemable (ResultValue a), ResultItemable (ResultValue (SamplingStats a))) => ResultProvider (Ref m (SamplingCounter a)) m Source # 
(MonadDES m, ResultItemable (ResultValue a)) => ResultProvider (Ref m a) m Source # 

refChanged :: Ref m a -> Signal m a Source #

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

refChanged_ :: MonadDES m => Ref m a -> Signal m () Source #

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

newRef :: MonadDES m => a -> Simulation m (Ref m a) Source #

Create a new reference.

newRef0 :: (MonadDES m, MonadRef0 m) => a -> m (Ref m a) Source #

Create a new reference within more low level computation than Simulation.

readRef :: MonadDES m => Ref m a -> Event m a Source #

Read the value of a reference.

writeRef :: MonadDES m => Ref m a -> a -> Event m () Source #

Write a new value into the reference.

modifyRef :: MonadDES m => Ref m a -> (a -> a) -> Event m () Source #

Mutate the contents of the reference.