sodium-0.3.0.1: Sodium Reactive Programming (FRP) System

Safe HaskellNone

FRP.Sodium.Internal

Synopsis

Documentation

listen :: Event p a -> (a -> Reactive p ()) -> Reactive p (IO ())Source

Variant of listenIO that allows you to initiate more activity in the current transaction. Useful for implementing new primitives.

listenValue :: Behaviour p a -> (a -> Reactive p ()) -> Reactive p (IO ())Source

Variant of listenValueIO that allows you to initiate more activity in the current transaction. Useful for implementing new primitives.

data Event p a Source

A stream of events. The individual firings of events are called 'event occurrences'.

Constructors

Event 

Fields

getListenRaw :: Reactive p (Listen p a)

Listen for event occurrences on this event, to be handled by the specified handler. The returned action is used to unregister the listener.

evCacheRef :: IORef (Maybe (Listen p a))
 

Instances

data Behaviour p a Source

A time-varying value, British spelling.

Constructors

Behaviour 

Fields

underlyingEvent :: Event p a

Internal: Extract the underlyingEvent event for this behaviour.

sample :: Reactive p a

Obtain the current value of a behaviour.

schedulePriority1 :: Reactive p () -> Reactive p ()Source

Queue the specified atomic to run at the end of the priority 1 queue

schedulePriority2 :: Maybe (MVar (Node p)) -> Reactive p () -> Reactive p ()Source

Queue the specified atomic to run at the end of the priority 2 queue

data Listen p a Source

Constructors

Listen 

Fields

runListen_ :: Maybe (MVar (Node p)) -> (a -> Reactive p ()) -> Reactive p (IO ())
 

getListen :: Event p a -> Reactive p (Listen p a)Source

Unwrap an event's listener machinery.

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.

data Node p Source

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.

finalizeEvent :: Event p a -> IO () -> Event p aSource

Add a finalizer to an event.

finalizeListen :: Listen p a -> IO () -> IO (Listen p a)Source

Add a finalizer to a listener.

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.