
Hi,
Is any generality lost because of this or are the approaches equivalent ?
Once you have a timer, you can make a behavior
time :: Behavior t Time
that indicates the current time and thus allows you to write functions that depend on the current clock time, just like in Conal's papers.
In other words, the approaches are largely equivalent.
The thing is just that different GUI or audio frameworks tend to have different implementations of timers and reactive-banana can't decide which one is more appropriate. For instance, Henning Thielemann uses ALSA-timers in his reactive-balsa package
http://hackage.haskell.org/package/reactive-balsa-0.0
At some point, I intend to offer some common time-related functionality (for example as in the Wave.hs example) for different backends.
Ok, I see, yes make sense. One other question, is it possible in reactive-banana to define “recursive” event streams. For instance consider a stream which receives numbers between 0.0 and 1.0. If the last outputted value was between 0.8 an 1.0 then output 1-x otherwise output x. After that it only leta numbers through if they are between 0.0 and 0.2 or between 0.8 and 1.0. This looks like: | x V --------------------------- | y > 0.8 |<--------------y----------------| | | | -------------------------- | | | | | yes | no | V V | 1-x x | | / | V / | -------------- | | | | | V | ---------------------------------------------------- | | select values between 0.0 and 0.2 | | | and 0 8 and 1.0 | | | || | ---------------------------------------------------- | | | |------------------------------------------------------------ | y | V best, Miguel Negrão