The documentation for the execute
function in Reactive.Banana.Frameworks
says that "there is no guarantee about the order in which the actions are executed."
I'm not sure which ordering is meant here. As the event only fires one action at once, there isn't much of an order to guarantee here, so the most likely scenario 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 I can imagine here is that the execution order of a
and b
is switched, thus b
gets executed first. If we assume that a
and b
both modify the behavior of some widget (using liftIO
) and then register their corresponding event handler (unregistering the previously registered one), switching the execution order of a
and b
would be fatal as it would leave the widget in a state where it doesn't fire the handlers it supposed to fire. As I don't see for which use cases execute
is still useful if my scenario is correct, I suppose the documentation actually means something else.
Can someone please clarify what the documentation is trying to say here?