I am not an expert in any way, but I used an older reactive banana for a program with such a need (unfortunately, at the moment I have no code on hand).
I think that explicit delays do not correspond super-naturally within a reactive banana structure, because you are always implicitly engaged in some kind of abstract time. Delaying with the help of certain intervals requires an appeal to the real world concept of time. I see that it would be very difficult to say something like union event (delay 1.0 event) would mean, from the point of view of the authoritative model, where type Event a = [Maybe a] : should it be [a, b, a, b] or [a, a, b, b] ? As I thought about this, the problem is that of these two results are not indicated, not taking into account the details of operational work.
But you can do this โaroundโ the banana-reactive framework by attaching an IO action to an event that you want to snooze that sleeps for a while (not in the main thread, obviously), and then fire another event. I believe that I was able to complete all this logic in a function that I could call from the NetworkDescription monad (this was before the Moment monad existed) to get my new event with a delay.
Ben
source share