Skip to content
Playground(another site)

bynk.provider.outside_context

Error provides was declared outside a context.

A provides block says how a context's own capability is implemented, so it belongs in the context that declares the capability. A commons holds only pure declarations, with no effects to provide. Move the provider into the context. A capability in a commons is refused for the same reason, as bynk.capability.outside_context.

Example

commons demo
provides Clock = FixedClock { // ✗ a commons cannot provide a capability
fn now() -> Effect[Int] { … }
}
context demo
capability Clock { fn now() -> Effect[Int] }
provides Clock = FixedClock { // ✓ in the context that declares `Clock`
fn now() -> Effect[Int] { … }
}

In the Book

See also

  • The grammar rule it governs: provider_decl.
  • Every code in its category, Providers, on the diagnostic index.
  • bynk explain bynk.provider.outside_context shows the same from the installed toolchain, without a network.