sodium-0.1.0.0: Sodium Reactive Programming (FRP) System

Safe HaskellNone

FRP.Sodium.Internal

Synopsis

Documentation

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 :: Int64 -> 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.

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.