RxHaskell-0.2: Reactive Extensions for Haskell

Safe HaskellSafe

Signal.Channel

Synopsis

Documentation

type Channel s v = (Subscriber s v, Signal s v)Source

A controllable signal, represented by a Subscriber and Signal pair.

Values sent to the subscriber will automatically be broadcast to all of the signal's subscribers. In effect, the subscriber is the write end, while the signal is the read end.

newChannel :: Scheduler s => IO (Channel s v)Source

Creates a simple channel which broadcasts all values sent to it.

Sending an ErrorEvent or CompletedEvent will terminate the channel.

data ChannelCapacity Source

Determines how many events a replay channel will save.

Constructors

LimitedCapacity Int

The channel will only save the specified number of events.

UnlimitedCapacity

The channel will save an unlimited number of events.

newReplayChannel :: forall s v. Scheduler s => ChannelCapacity -> IO (Channel s v)Source

Like newChannel, but new subscriptions to the returned signal will receive all values (up to the specified capacity) which have been sent thus far.

Sending an ErrorEvent or CompletedEvent will terminate the channel. Any terminating event will be replayed to future subscribers, assuming sufficient capacity.

data Signal s v Source

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

data Subscriber s v Source

Receives events from a signal with values of type v and running in a scheduler of type s.

Note that s refers to the scheduler that events must be sent on. Events are always sent synchronously, regardless of s.

class Scheduler s Source

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