Overview of kyo-compat
mainWhat is kyo-compat?
kyo-compat is a compatibility layer that allows you to write a library once against the kyo.compat.* surface and deploy it across five different backends. This enables cross-backend portability without sacrificing performance or backend-specific features.
Key Benefits
- Overhead-free: Every method is an
inline defthat lowers to the backend's primitive at the call site. There is no typeclass dispatch or adapter layer overhead. - Runtime-free: Each backend artifact (e.g.,
kyo-compat-zio) depends only on its target runtime, not on other Kyo modules. - Uniform surface: Provides a consistent API for fibers, promises, channels, atomics, latches, meters, fiber-locals, time, and concurrency.
- Preserves backend features: Features like ZIO
Trace, KyoFrame, fiber locals, scoped resources, and runtime stack traces flow throughCIOunchanged.
Supported Backends
The cross-backend computation type CIO[+A] is an opaque alias that resolves differently depending on which backend artifact you include in your project:
| Backend | CIO[+A] resolves to | Provided by |
|---|---|---|
| Kyo | A < (Abort[Throwable] & Async) | kyo-compat-kyo |
| ZIO | zio.ZIO[Any, Throwable, A] | kyo-compat-zio |
| Future | LocalCtx => scala.concurrent.Future[A] | kyo-compat-future |
| Ox | (Int, ox.Ox) => A | kyo-compat-ox |
| Twitter Future | () => com.twitter.util.Future[A] | kyo-compat-twitter-future |