bynk.effect.do_on_non_effect
Error A do statement was applied to a non-Effect value.
do e performs an effect, so its operand must be an Effect[T]: a call to something effectful. A plain value has nothing to run, which usually means the operand is not the call you meant. Call the effectful function you intended. If you wanted the value, bind it with let. An effect whose result is a Result is bynk.effect.do_discards_result, and <- on a plain value is bynk.effect.bind_on_non_effect.
Example
fn ping() -> Effect[()] { Effect.pure(())}
fn clear() -> Effect[()] { do 5 // ✗ `5` is an `Int`, not an `Effect[T]`}
fn clear() -> Effect[()] { do ping() // ✓ an effect}In the Book
See also
- The grammar rule it governs:
do_stmt. - Every code in its category, Effects, on the diagnostic index.
bynk explain bynk.effect.do_on_non_effectshows the same from the installed toolchain, without a network.