bynk.race.in_pure_context
Error a.race(b) was used in a pure (non-effectful) context.
race starts two effects and hands the loser to the execution context, and only an effectful body has one: a pure function never runs an effect at all. Change the enclosing function's return type to Effect[…] so its body can run it. The same rule holds for bynk.within.in_pure_context.
Example
fn first(a: Effect[Int], b: Effect[Int]) -> Int { let c = a.race(b) // ✗ the body is pure 0}
fn first(a: Effect[Int], b: Effect[Int]) -> Effect[Int] { // ✓ an effectful body a.race(b)}In the Book
See also
- The grammar rule it governs:
method_call. - Every code in its category, Other, on the diagnostic index.
bynk explain bynk.race.in_pure_contextshows the same from the installed toolchain, without a network.