Safe Haskell | None |
---|
- listen :: Event p a -> (a -> Reactive p ()) -> Reactive p (IO ())
- listenValue :: Behaviour p a -> (a -> Reactive p ()) -> Reactive p (IO ())
- data Event p a = Event {
- getListenRaw :: Reactive p (Listen p a)
- evCacheRef :: IORef (Maybe (Listen p a))
- data Behaviour p a = Behaviour {
- underlyingEvent :: Event p a
- sample :: Reactive p a
- schedulePriority1 :: Reactive p () -> Reactive p ()
- schedulePriority2 :: Int64 -> Reactive p () -> Reactive p ()
- data Listen p a = Listen {}
- getListen :: Event p a -> Reactive p (Listen p a)
- runListen :: Listen p a -> Maybe (MVar (Node p)) -> (a -> Reactive p ()) -> Reactive p (IO ())
- linkedListen :: Event p a -> Maybe (MVar (Node p)) -> (a -> Reactive p ()) -> Reactive p (IO ())
- data Node p
- newEventLinked :: Typeable p => IO (Event p a, a -> Reactive p (), MVar (Node p))
- newSink :: forall p a. Typeable p => IO (Listen p a, a -> Reactive p (), MVar (Node p))
- finalizeEvent :: Event p a -> IO () -> Event p a
- finalizeListen :: Listen p a -> IO () -> IO (Listen p a)
- ioReactive :: IO a -> Reactive p a
- data Unlistener
- finalerize :: Unlistener -> Listen p a -> Reactive p (Listen p a)
- unlistenize :: Reactive p (IO ()) -> Reactive p Unlistener
Documentation
listen :: Event p a -> (a -> Reactive p ()) -> Reactive p (IO ())Source
Listen for firings of this event. The returned IO ()
is an IO action
that unregisters the listener. This is the observer pattern.
listenValue :: Behaviour p a -> (a -> Reactive p ()) -> Reactive p (IO ())Source
Listen to the value of this behaviour with a guaranteed initial callback giving the current value, followed by callbacks for any updates.
A stream of events. The individual firings of events are called 'event occurrences'.
Event | |
|
A time-varying value, British spelling.
Behaviour | |
|
Functor (Behaviour p) | |
Typeable p => Applicative (Behaviour p) |
schedulePriority1 :: Reactive p () -> Reactive p ()Source
Queue the specified atomic to run at the end of the priority 1 queue
schedulePriority2 :: Int64 -> Reactive p () -> Reactive p ()Source
Queue the specified atomic to run at the end of the priority 2 queue
runListen :: Listen p a -> Maybe (MVar (Node p)) -> (a -> Reactive p ()) -> Reactive p (IO ())Source
linkedListen :: Event p a -> Maybe (MVar (Node p)) -> (a -> Reactive p ()) -> Reactive p (IO ())Source
Listen for firings of this event. The returned IO ()
is an IO action
that unregisters the listener. This is the observer pattern.
newEventLinked :: Typeable p => IO (Event p a, a -> Reactive p (), MVar (Node p))Source
Returns an event, and a push action for pushing a value into the event.
newSink :: forall p a. Typeable p => IO (Listen p a, a -> Reactive p (), MVar (Node p))Source
Returns a Listen
for registering listeners, and a push action for pushing
a value into the event.
ioReactive :: IO a -> Reactive p aSource
data Unlistener Source
finalerize :: Unlistener -> Listen p a -> Reactive p (Listen p a)Source
Cause the things listened to with unlistenize to be unlistened when the specified listener is not referenced any more.
unlistenize :: Reactive p (IO ()) -> Reactive p UnlistenerSource
Listen to an input event/behaviour and return an Unlistener
that can be
attached to an output event using finalerize
.