Safe Haskell | Safe |
---|
- type Channel s v = (Subscriber s v, Signal s v)
- newChannel :: Scheduler s => IO (Channel s v)
- data ChannelCapacity
- newReplayChannel :: forall s v. Scheduler s => ChannelCapacity -> IO (Channel s v)
- data Signal s v
- data Subscriber s v
- class Scheduler s
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.
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.
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
.
Represents a queue of IO
actions which can be executed in FIFO order.