Copyright | Copyright (c) 2009-2014, 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 7.8.3
This module defines an updatable reference that depends on the event queue.
- data Ref m a
- refChanged :: MonadComp m => Ref m a -> Signal m a
- refChanged_ :: MonadComp m => Ref m a -> Signal m ()
- newRef :: MonadComp m => a -> Simulation m (Ref m a)
- readRef :: MonadComp m => Ref m a -> Event m a
- writeRef :: MonadComp m => Ref m a -> a -> Event m ()
- modifyRef :: MonadComp 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.
MonadComp m => ResultComputing Ref m |
refChanged :: MonadComp m => Ref m a -> Signal m a Source
Return a signal that notifies about every change of the reference state.
refChanged_ :: MonadComp m => Ref m a -> Signal m () Source
Return a signal that notifies about every change of the reference state.
newRef :: MonadComp m => a -> Simulation m (Ref m a) Source
Create a new reference.