Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|

License | BSD3 |

Maintainer | David Sorokin <david.sorokin@gmail.com> |

Stability | experimental |

Safe Haskell | None |

Language | Haskell2010 |

Tested with: GHC 8.0.1

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

- data Ref m a
- refChanged :: Ref m a -> Signal m a
- refChanged_ :: MonadDES m => Ref m a -> Signal m ()
- newRef :: MonadDES m => a -> Simulation m (Ref m a)
- newRef0 :: (MonadDES m, MonadRef0 m) => a -> m (Ref m a)
- readRef :: MonadDES m => Ref m a -> Event m a
- writeRef :: MonadDES m => Ref m a -> a -> Event m ()
- modifyRef :: MonadDES m => Ref m a -> (a -> a) -> Event m ()

# Documentation

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.

MonadDES m => ResultComputing Ref m Source # | |

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

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

(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.