Events and signal functions with Yampa
Yampa is an FRP framework that supports both continuous and discrete time. In Yampa, the most important concept is the signal function (SF). Signal functions are first-class transformations on signals, that is, time-dependent values:
data SF a b -- think: Signal a → Signal b -- instance Arrow, ArrowLoop, Category
Signal functions can be created and manipulated via the Arrow interface. For instance, a pure transformation (a → b
) is turned into a signal function simply with arr
from the Arrow
class. Here's a signal function which squares values passed through it:
square :: SF Double Double square = arr (^2)
The embed
utility function can be used to test signal functions:
embed square (1, [(0, Just 2), (1, Just ...
Get Haskell High Performance Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.