bynk.effect.do_discards_result
Error A do statement was applied to an Effect[Result[_, _]], which would drop an Err; bind it, write let _ <- e to discard it deliberately, or do e.detach() to stop waiting and have a failure reported.
do e awaits an effect and discards what it returns, which is fine for a unit or an ordinary value but not for a Result: an Err dropped this way is lost without a trace. Bind it and handle the error with let r <- e and a match (or ?). If dropping the outcome is really what you want, write let _ <- e, which is legal and keeps the discard visible in the source. do on a plain value is bynk.effect.do_on_non_effect.
Example
fn send() -> Effect[Result[Int, String]] { Effect.pure(Ok(1))}
fn run() -> Effect[()] { do send() // ✗ would silently drop an `Err`}
fn run() -> Effect[()] { let _ <- send() // ✓ the discard is written out Effect.pure(())}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_discards_resultshows the same from the installed toolchain, without a network.