Module

Signal

#constant

constant :: forall a. a -> Signal a

Creates a signal with a constant value.

#merge

merge :: forall a. (Signal a) -> (Signal a) -> (Signal a)

Merge two signals, returning a new signal which will yield a value whenever either of the input signals yield. Its initial value will be that of the first signal.

#mergeMany

mergeMany :: forall f a. Functor f => Foldable f => f (Signal a) -> Maybe (Signal a)

Merge all signals inside a Foldable, returning a Maybe which will either contain the resulting signal, or Nothing if the Foldable was empty.

#foldp

foldp :: forall a b. (a -> b -> b) -> b -> (Signal a) -> (Signal b)

Creates a past dependent signal. The function argument takes the value of the input signal, and the previous value of the output signal, to produce the new value of the output signal.

#sampleOn

sampleOn :: forall a b. (Signal a) -> (Signal b) -> (Signal b)

Creates a signal which yields the current value of the second signal every time the first signal yields.

#dropRepeats

dropRepeats :: forall a. Eq a => Signal a -> Signal a

Create a signal which only yields values which aren't equal to the previous value of the input signal.

#dropRepeats'

dropRepeats' :: forall a. (Signal a) -> (Signal a)

#runSignal

runSignal :: Signal (Effect Unit) -> Effect Unit

Given a signal of effects with no return value, run each effect as it comes in.

#unwrap

unwrap :: forall a. Signal (Effect a) -> Effect (Signal a)

Takes a signal of effects of a, and produces an effect which returns a signal which will take each effect produced by the input signal, run it, and yield its returned value.

#get

get :: forall a. Signal a -> Effect a

Gets the current value of the signal.

#filter

filter :: forall a. (a -> Boolean) -> a -> (Signal a) -> (Signal a)

Takes a signal and filters out yielded values for which the provided predicate function returns false.

#filterMap

filterMap :: forall a b. (a -> Maybe b) -> b -> Signal a -> Signal b

Map a signal over a function which returns a Maybe, yielding only the values inside Justs, dropping the Nothings.

#flatten

flatten :: forall a f. Functor f => Foldable f => Signal (f a) -> a -> Signal a

Turns a signal of collections of items into a signal of each item inside each collection, in order.

#flattenArray

flattenArray :: forall a. Signal (Array a) -> a -> Signal a

Turns a signal of arrays of items into a signal of each item inside each array, in order.

Like flatten, but faster.

#(<~)

Operator alias for Signal.squigglyMap (left-associative / precedence 4)

#(~>)

Operator alias for Signal.flippedMap (left-associative / precedence 4)

#(~)

Operator alias for Signal.squigglyApply (left-associative / precedence 4)

#squigglyMap

squigglyMap :: forall f a b. Functor f => (a -> b) -> f a -> f b

#squigglyApply

squigglyApply :: forall f a b. Apply f => f (a -> b) -> f a -> f b

#flippedMap

flippedMap :: forall f a b. Functor f => f a -> (a -> b) -> f b

#map2

map2 :: forall a b c. (a -> b -> c) -> Signal a -> Signal b -> Signal c

#map3

map3 :: forall a b c d. (a -> b -> c -> d) -> Signal a -> Signal b -> Signal c -> Signal d

#map4

map4 :: forall a b c d e. (a -> b -> c -> d -> e) -> Signal a -> Signal b -> Signal c -> Signal d -> Signal e

#map5

map5 :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Signal a -> Signal b -> Signal c -> Signal d -> Signal e -> Signal f

Modules