bearriver-0.14.7: FRP Yampa replacement implemented with Monadic Stream Functions.
Copyright(c) Ivan Perez 2019-2022
(c) Ivan Perez and Manuel Baerenz 2016-2018
LicenseBSD3
Maintainerivan.perez@keera.co.uk
Safe HaskellSafe-Inferred
LanguageHaskell2010

FRP.BearRiver.Hybrid

Description

Discrete to continuous-time signal functions.

Synopsis

Discrete to continuous-time signal functions

Wave-form generation

hold :: Monad m => a -> SF m (Event a) a Source #

Zero-order hold.

Converts a discrete-time signal into a continuous-time signal, by holding the last value until it changes in the input signal. The given parameter may be used for time zero, and until the first event occurs in the input signal, so hold is always well-initialized.

>>> embed (hold 1) (deltaEncode 0.1 [NoEvent, NoEvent, Event 2, NoEvent, Event 3, NoEvent])
[1,1,2,2,3,3]

Accumulators

accumBy :: Monad m => (b -> a -> b) -> b -> SF m (Event a) (Event b) Source #

Accumulator parameterized by the accumulation function.

accumHoldBy :: Monad m => (b -> a -> b) -> b -> SF m (Event a) b Source #

Zero-order hold accumulator parameterized by the accumulation function.

Events

mapEventS :: Monad m => SF m a b -> SF m (Event a) (Event b) Source #

Apply an SF to every input. Freezes temporarily if the input is NoEvent, and continues as soon as an Event is received.