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

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 Source

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 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)

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

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 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 f a b. Functor f => (a -> b) -> f a -> f b

#squigglyApply Source

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

#flippedMap Source

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

#map2 Source

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

#map3 Source

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

#map4 Source

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

#map5 Source

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