Skip to content
Playground(another site)

bynk.provider.dependency_cycle

Error Providers form a capability dependency cycle through given.

A provider's given lists the capabilities it is built from, and the context builds providers in dependency order. A capability that depends on itself, directly or through other providers, has no order to be built in, so every provider on the cycle is reported. Break the cycle: remove a given one side does not really need, move the part both need into a third capability that each depends on, or merge the two if they are one thing. Dependencies on other contexts follow consumes, which has its own check, bynk.context.consumes_cycle.

Example

capability Clock {
fn now() -> Effect[Int]
}
provides Clock = Fixed given Clock { // ✗ `Clock` is built from itself
fn now() -> Effect[Int] { Effect.pure(0) }
}
provides Clock = Fixed { // ✓ built from nothing
fn now() -> Effect[Int] { Effect.pure(0) }
}

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.dependency_cycle shows the same from the installed toolchain, without a network.