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
Pulse
andLatch
types are probably best seen as "lemmas" that I came up with that are very useful for implementing theEvent
andBehavior
type. 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
Pulse
is almost the same asEvent
, except that all functions are required to have a monadic type, e.g.The
Event
type is implemented by getting rid of theBuild
monad via black magic (= observable sharing). The nameBuild
sounds 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
Latch
is also very similar toBehavior
, except that the latter also includes anEvent
for pragmatic reasons. Similar considerations apply concerning theBuild
monad.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.