bynk.effect.bind_on_non_effect
Error An <- bind was applied to a non-Effect value.
let x <- e waits for e and binds its result, so e must be an Effect[T]. A plain value has nothing to wait for, and <- on one usually means the right-hand side is not the call you meant. Write let x = … for a pure binding. Where an effect is required and you hold a plain value, wrap it with Effect.pure(…). A <- in a body that is not itself effectful is bynk.effect.bind_in_pure_context.
Example
fn run() -> Effect[Int] { let x <- 42 // ✗ `42` is an `Int`, not an `Effect[Int]` Effect.pure(x)}
fn run() -> Effect[Int] { let x = 42 // ✓ a pure binding Effect.pure(x)}In the Book
See also
- The grammar rule it governs:
effect_let_stmt. - Every code in its category, Effects, on the diagnostic index.
bynk explain bynk.effect.bind_on_non_effectshows the same from the installed toolchain, without a network.