Skip to content
Playground(another site)

bynk.parse.expected_provider_op

Error Expected a provider operation.

A provider body implements the operations its capability declares, each starting with fn and carrying a body. The parser found something else where the next operation should begin. The commonest cause is leaving off the fn; an on handler, a type or a let does not belong in a provider either. The message names the token it found, and the position is where the operation should have started. A capability body has the same rule: bynk.parse.expected_capability_op.

Example

capability Clock {
fn now() -> Effect[Int]
}
provides Clock = FixedClock {
now() -> Effect[Int] { Effect.pure(1) } // ✗ an operation starts with `fn`
}
provides Clock = FixedClock {
fn now() -> Effect[Int] { Effect.pure(1) } // ✓
}

In the Book

See also

  • The grammar rule it governs: provider_op.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.expected_provider_op shows the same from the installed toolchain, without a network.