Core Concept: Signal Functions (SF)
developIn Yampa, a system is defined by a Signal Function (SF). An SF determines how varying inputs relate to varying outputs over time.
Programming in Yampa supports three interchangeable styles:
- Arrowized style: Uses
procnotation and arrow syntax (requires{-# LANGUAGE Arrows #-}). - Applicative style: Uses standard applicative operators like
<$>and<*>. - Functional style: Uses arrow combinators.
Example of an SF that integrates an input and divides it by the current time:
{-# LANGUAGE Arrows #-}
import FRP.Yampa
signalFunction :: SF Double Double
signalFunction = proc x -> do
y <- integral -< x
t <- time -< ()
returnA -< y / t