ramus-0.1.2: Elm signal system for Haskell

Safe HaskellNone
LanguageHaskell2010

Ramus.Signal

Contents

Synopsis

Documentation

data Signal a #

constant :: a -> Signal a #

Creates a signal with a constant value.

merge :: 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 :: (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 :: (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 :: 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 :: 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.

runSignal :: Signal (IO ()) -> IO () #

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

filter :: (a -> Bool) -> a -> Signal a -> Signal a #

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

filterMap :: (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.

(~>) :: Signal a -> (a -> b) -> Signal b infixl 4 #

Flipped map operator

(<~) :: (a -> b) -> Signal a -> Signal b infixl 4 #

map operator

(~~) :: Signal (a -> b) -> Signal a -> Signal b infixl 4 #

Signal application. | Note that it is a double tilde, differing from | purescript-signal, as a single tilde is used | in Haskell for lazy evaluation.

map2 :: (a -> b -> c) -> Signal a -> Signal b -> Signal c #

map3 :: (a -> b -> c -> d) -> Signal a -> Signal b -> Signal c -> Signal d #

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

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

Orphan instances

Functor Signal # 

Methods

fmap :: (a -> b) -> Signal a -> Signal b #

(<$) :: a -> Signal b -> Signal a #

Applicative Signal # 

Methods

pure :: a -> Signal a #

(<*>) :: Signal (a -> b) -> Signal a -> Signal b #

(*>) :: Signal a -> Signal b -> Signal b #

(<*) :: Signal a -> Signal b -> Signal a #

Semigroup (Signal a) # 

Methods

(<>) :: Signal a -> Signal a -> Signal a #

sconcat :: NonEmpty (Signal a) -> Signal a #

stimes :: Integral b => b -> Signal a -> Signal a #