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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.