How is the execution of banana reagent execution not guaranteed?

The documentation for the execute function in Reactive.Banana.Frameworks states that "there is no guarantee about the order in which actions are performed."

I am not sure which order is implied here. Since the event only fires immediately after one action, there is not much guarantee here, therefore the most likely scenario that I can imagine is this:

 a :: MomentIO (Event t) a = ... b :: MomentIO (Event t) b = ... makeEvent :: MomentIO (Event (MomentIO (Event t)) makeEvent = fromAddHandler $ ... -- Some AddHandler that first fires a -- and later fires b network :: MomentIO () network = do ... newEvents <- makeEvent ts <- execute newEvents >>= switchE ... 

The non-guarantee that I can imagine is that the execution order of a and b switched, so b is executed first. If we assume that a and b change the behavior of a widget (using liftIO ), and then register the corresponding event handler (unregisters the previously registered one), switching the execution order of a and b will be fatal, since it will leave the widget in a state when it does not start the handlers that it should run. Since I don't see which use cases for execute are still useful if my script is correct, I believe the documentation actually means something else.

Can anyone clarify what the documentation is trying to say here?

+6
source share

Source: https://habr.com/ru/post/1014922/


All Articles