Racing
E.race_first(left, right) returns the first completed outcome, whether success, typed failure, defect, or interruption. It interrupts the loser and awaits its finalizers; loser cleanup cannot replace the winner's outcome. The left wins when both are complete at selection. Cancelling the parent waits for both branches to finish cleanup.
Both branches inherit surrounding requirements, including the Clock, and the result carries the union of their value, error, and requirement types. Racing is async only: synchronous runners report AsyncEffectInSyncRun.
# Stop the heartbeat when the operation completes; a heartbeat failure
# also stops the operation.
program = E.((), ())
Resource lifetime follows the owning scope: use branch.scoped() to release that branch's resources before the race returns. Resources acquired into a surrounding scope live until that scope closes. Racing fiber.join() interrupts the waiter; the independently forked fiber keeps running.
More examples: test_race.py.