RxHaskell-0.2: Reactive Extensions for Haskell

Safe HaskellSafe

Signal.Command

Synopsis

Documentation

data Command v Source

A signal triggered in response to some action, typically UI-related.

data CommandPolicy Source

Determines a command's behavior.

Constructors

ExecuteSerially

The command can only be executed once at a time. Attempts to execute while the command is already running will fail.

ExecuteConcurrently

The command can be executed concurrently any number of times.

newCommandSource

Arguments

:: CommandPolicy

Determines how the command behaves when asked to execute multiple times simultaneously.

-> Signal MainScheduler Bool

A signal which sends whether the command should be enabled. canExecute will send True before this signal sends its first value.

-> SchedulerIO MainScheduler (Command v) 

Creates a command.

canExecute :: Command v -> Signal MainScheduler BoolSource

Sends whether this command is able to execute.

This signal will always send at least one value immediately upon subscription.

executing :: Command v -> Signal MainScheduler BoolSource

Sends whether this command is currently executing.

This signal will always send at least one value immediately upon subscription.

executeSource

Arguments

:: Command v

The command to execute.

-> v

A value to send to the command's subscribers.

-> SchedulerIO MainScheduler Bool

Whether execution succeeded. This will be False if the command is disabled.

Attempts to execute a command.

values :: Command v -> Signal MainScheduler vSource

A signal of the values passed to execute.

onExecuteSource

Arguments

:: Command v

The command to attach behavior to.

-> (v -> Signal BackgroundScheduler ())

A function which maps from the command's values to a signal of side-effecting work.

-> SchedulerIO MainScheduler (Signal MainScheduler (Signal BackgroundScheduler ()))

A signal of the created signals.

Creates a signal whenever the command executes, then subscribes to it.

errors :: Command v -> Signal MainScheduler IOExceptionSource

A signal of errors received from all signals created by onExecute.

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.

data Signal s v Source

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

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.

data BackgroundScheduler Source

A scheduler which runs enqueued actions in a dedicated background thread.

data MainScheduler Source

A scheduler which runs enqueued actions on the main thread.

Instances

Scheduler MainScheduler 
Show v => Show (SchedulerIO MainScheduler v)

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