Do the Latch and Pulse types exist in FRP literature, or are they an invention of the author of reactive-banana?
Just looking at the types, they roughly correspond to Behavior and Event (respectively), but I'd like to know what the difference is, and whether their implementation is based on any formal research.
Thank you!
Heinrich here. The
PulseandLatchtypes are probably best seen as "lemmas" that I came up with that are very useful for implementing theEventandBehaviortype. I'm sure that they will prove useful when trying to justify the implementation more formally, but this is a formidable research project, and I have not found the time or resources to do so.The type
Pulseis almost the same asEvent, except that all functions are required to have a monadic type, e.g.The
Eventtype is implemented by getting rid of theBuildmonad via black magic (= observable sharing). The nameBuildsounds like it's a utility monad, which it is if you look at the code, but this monad is also fundamental, because it has a semantic interpretation as "moment of time", and it's not obvious why you can remove it sometimes, and sometimes not.The type
Latchis also very similar toBehavior, except that the latter also includes anEventfor pragmatic reasons. Similar considerations apply concerning theBuildmonad.I hope this answers more questions than it raises. Sorry that I couldn't go into more detail as for the inner workings of reactive-banana, that would be beyond the scope of a StackOverflow answer.