RxHaskell-0.2: Reactive Extensions for Haskell

Safe HaskellSafe

Signal

Synopsis

Documentation

data Signal s v Source

A signal which will send values of type v on a scheduler of type s.

signalSource

Arguments

:: Scheduler s 
=> (Subscriber s v -> SchedulerIO s Disposable)

An action to run on each subscription.

-> Signal s v

The constructed signal.

Constructs a signal which sends its values to new subscribers synchronously.

subscribeSource

Arguments

:: Scheduler s 
=> Signal s v

The signal to subscribe to.

-> Subscriber s v

The subscriber to attach.

-> SchedulerIO s Disposable

A disposable which can be used to terminate the subscription.

Subscribes to a signal.

(>>:)Source

Arguments

:: Scheduler s 
=> Signal s v

The signal to subscribe to.

-> (Event v -> SchedulerIO s ())

An action to run when each event is received.

-> SchedulerIO s Disposable

A disposable which can be used to terminate the subscription.

Creates a subscriber and subscribes to the signal.

never :: Scheduler s => Signal s vSource

Returns a signal which never sends any events.

empty :: Scheduler s => Signal s vSource

Returns a signal which immediately completes.

data Event v Source

Represents an event that a signal might send.

Signals may send any number of NextEvents, followed by one ErrorEvent or CompletedEvent.

Constructors

NextEvent v

A value v in the monad.

ErrorEvent IOException

Sent when an error or exception occurs in the signal. Outside of the monad.

CompletedEvent

Sent when the signal completes successfully. Outside of the monad.

Instances

Eq v => Eq (Event v) 
Show v => Show (Event v) 

data Disposable Source

Allows disposal of a resource by running an action in the monad m.

Instances

class Scheduler s Source

Represents a queue of IO actions which can be executed in FIFO order.

data SchedulerIO s a Source

An IO computation that must be performed in a scheduler of type s.

Instances

Scheduler s => Monad (SchedulerIO s) 
Functor (SchedulerIO s) 
Scheduler s => Applicative (SchedulerIO s) 
Scheduler s => MonadIO (SchedulerIO s) 
Show v => Show (SchedulerIO BackgroundScheduler v) 
Show v => Show (SchedulerIO MainScheduler v)

Unsafely executes a SchedulerIO action and shows the result. This is for DEBUGGING PURPOSES ONLY.