Module

Signal

Package
purescript-signal
Repository
bodil/purescript-signal

#constant Source

constant :: forall a. a -> Signal a

Creates a signal with a constant value.

#merge Source

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 Source

mergeMany :: forall a f. 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 Source

foldp :: forall b a. (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 Source

sampleOn :: forall b a. (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 Source

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' Source

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

Create a signal which only yields values which aren't equal to the previous value of the input signal, using JavaScript's !== operator to determine disequality.

#runSignal Source

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

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

#unwrap Source

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 Source

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

Gets the current value of the signal.

#filter Source

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 Source

filterMap :: forall b a. (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 Source

flatten :: forall f a. 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 Source

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.

#(<~) Source

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

#(~>) Source

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

#(~) Source

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

#squigglyMap Source

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

#squigglyApply Source

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

#flippedMap Source

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

#map2 Source

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

#map3 Source

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

#map4 Source

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

#map5 Source

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