Skip to content
Playground(another site)

bynk.service.return_not_effect

Error A service handler's return type is not an Effect.

Every service handler returns an Effect[T], whatever its protocol. A handler runs as the context answers a call, route, schedule, message or frame, and its effects and given capabilities are the runtime's to run, so a bare Int is refused. Wrap the result: Effect.pure(x) for a value you already hold. An on event handler that returns an Effect of anything but () is bynk.event.return_not_effect_unit.

Example

service probe {
on call() -> Int by Caller { … } // ✗ not an `Effect`
on call() -> Effect[Int] by Caller { … } // ✓
}

In the Book

See also

  • The grammar rule it governs: service_decl.
  • Every code in its category, Services, on the diagnostic index.
  • bynk explain bynk.service.return_not_effect shows the same from the installed toolchain, without a network.