All the elements are mapped with G.extract in order. G.extract may be blocking, like Await.result on a Future. So one choice that never happens may prevent all the subsequent ones from being considered.
Instead, what is needed is a kind of an Observable which will try to extract all the choices simultaneously and will emit them in order in which they happen.
The first choice that does not evaluate to Failure should be considered. Optionally, the remaining choices should be cancelled, allowing them to terminate gracefully.
Currently, the tree that needs resumption is processed as follows:
All the elements are mapped with
G.extract
in order.G.extract
may be blocking, likeAwait.result
on aFuture
. So one choice that never happens may prevent all the subsequent ones from being considered.Instead, what is needed is a kind of an
Observable
which will try to extract all the choices simultaneously and will emit them in order in which they happen.The first choice that does not evaluate to
Failure
should be considered. Optionally, the remaining choices should be cancelled, allowing them to terminate gracefully.