I tested this and it seems that the order of event handling is the same as the order of the list in the source event. I don't think I can rely on this as the documentation only states:
Emit simultaneous event occurrences. Up to strictness, we have spill . collect = id
How can I create a function similar to spill with a specification like:
Emit sequential event occurrences with the guarantee that no other events will fire between the first and last
Or should I try a different approach? I am trying to implementing macro functionality in Reactive-Banana
(I'm the author of reactive-banana.)
It seems that the order of event handling is the same as the order of the list in the source event.
This is correct, you can rely on that. In fact, it more or less follows from the equation spill . collect = id
. After all, to yield the identity mapping, spill
must preserve the order of the events ascollect
has put them in the list.
Furthermore, you can inspect the source code of the modules Reactive.Banana.Model
(Reactive.Banana.Internal.Model
in version 0.5) and Reactive.Banana.Combinators
. Taken together, they give an authoritative model implementation. You can directly check how spill
behaves. (Though it may be a little confusing since the model is built in two parts.)
Nonetheless, I shall add a few words to the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With