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

CopyrightCopyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.Ref.Plain

Description

Tested with: GHC 7.8.3

This module defines a plain and more fast version of an updatable reference that depends on the event queue but that doesn't supply with the signal notification.

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

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

Create a new reference.

readRef :: MonadComp m => Ref m a -> Event m a Source

Read the value of a reference.

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

Write a new value into the reference.

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

Mutate the contents of the reference.