aivika-transformers-5.9.1: 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.Base.Strict

Description

Tested with: GHC 8.0.1

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

Synopsis

Documentation

class Monad m => MonadRef m where Source #

A monad within which we can create mutable references.

Associated Types

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.

Methods

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

Create a new reference.

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

Read the value of a reference.

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

Write a new value into the reference.

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

Mutate the contents of the reference.

equalRef :: Ref m a -> Ref m a -> Bool Source #

Compare two references for equality.

Instances

Instances details
MonadRef IO Source #

IO is an instance of MonadRef.

Instance details

Defined in Simulation.Aivika.IO.Ref.Base.Strict

Associated Types

data Ref IO a Source #

Methods

newRef :: a -> Simulation IO (Ref IO a) Source #

readRef :: Ref IO a -> Event IO a Source #

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

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

equalRef :: Ref IO a -> Ref IO a -> Bool Source #

class MonadRef m => MonadRef0 m where Source #

A kind of reference that can be created within more low level computation than Simulation.

Methods

newRef0 :: a -> m (Ref m a) Source #

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

Instances

Instances details
MonadRef0 IO Source #

IO is an instance of MonadRef0.

Instance details

Defined in Simulation.Aivika.IO.Ref.Base.Strict

Methods

newRef0 :: a -> IO (Ref IO a) Source #