parallel-io icon indicating copy to clipboard operation
parallel-io copied to clipboard

parallelFirst with cancel

Open nstepp opened this issue 1 year ago • 0 comments

At first I thought that parallelFirst was exactly what I needed for my problem, but unless I'm not using it right (which is very possible), it's just a bit different than I was expecting.

It returns the first result, but all actions are computed, instead of canceling the remaining computations after the first result. Is it supposed to cancel them, and I'm seeing an odd behavior?

Would it match the intended semantics of parallelFirst if it were changed to this behavior, or would a parallelFirstCancel be useful? There is an analogous function in async: waitAnyCancel, but it doesn't provide the pool mechanics or use Maybe.

nstepp avatar Sep 12 '23 15:09 nstepp