Skip to content
Playground(another site)

bynk.par.invalid_statement

Error A par { … } block holds a statement other than let x <- e or do e: a refutable let … else, a plain let, := or a store write, expect, advance, a nested par, or anything that is not a statement.

A par { … } block issues all its bindings together and waits for them, so it holds only let x <- e and do e. Anything else has no effect to overlap, nothing to join, or must stay in order: a plain let, := or a store write, expect, advance, a nested par, a let … else, a bare expression (write do e) and an empty block. Store writes stay sequential; for parTraverse closures the rule is bynk.par.store_write_in_closure. Move the statement before or after the block; the names a block binds are in scope after its closing brace. See also bynk.par.sibling_name (a binding reading another binding of the same block) and the warning bynk.par.single_binding.

Example

par {
let a <- Users.get(id)
let b = 1 // ✗ a plain `let` has no effect to overlap
}
let b = 1 // ✓ compute it before the block
par {
let a <- Users.get(id)
let c <- Users.get(b)
}

In the Book

See also

  • The grammar rule it governs: par_stmt.
  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.par.invalid_statement shows the same from the installed toolchain, without a network.