September 2016
Intermediate to advanced
408 pages
9h 18m
English
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 ...Read now
Unlock full access