Safe Haskell | Safe |
---|
- data Subscriber s v
- subscriber :: Scheduler s => (Event v -> SchedulerIO s ()) -> IO (Subscriber s v)
- send :: forall s v. Scheduler s => Subscriber s v -> Event v -> SchedulerIO s ()
- data Event v
- = NextEvent v
- | ErrorEvent IOException
- | CompletedEvent
Documentation
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
.
:: Scheduler s | |
=> (Event v -> SchedulerIO s ()) | An action to run when each event is received. |
-> IO (Subscriber s v) | The constructed subscriber. |
Constructs a subscriber.
send :: forall s v. Scheduler s => Subscriber s v -> Event v -> SchedulerIO s ()Source
Synchronously sends an event to a subscriber.
Represents an event that a signal might send.
Signals may send any number of NextEvent
s, followed by one ErrorEvent
or CompletedEvent
.
NextEvent v | A value |
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. |