Skip to content
Playground(another site)

bynk.provider.generic_op_requires_external

Error A Bynk-bodied provides implements a capability operation that declares its own type parameter — only an external (bodiless) provider can.

A capability operation with its own type parameter, fn dedup[T](…), can only be implemented by an external provider: a class written in TypeScript in an adapter's binding file. A provider with a Bynk body has no T to work with, so it could only return a value it was already given. Declare the capability in an adapter and give provides no body. An external provider inside a context is refused, as bynk.context.external_provider.

Example

capability Audit {
fn note[T](key: String) -> Effect[()]
}
provides Audit = MemoAudit { // ✗ a generic operation cannot have a Bynk body
fn note(key: String) -> Effect[()] { … }
}
adapter audit {
binding "./audit.binding.ts"
provides Audit = MemoAudit // ✓ the binding supplies it
}

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