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

CopyrightCopyright (c) 2009-2016 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 #

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.