Skip to content

Commit

Permalink
remove zio integration for now :(
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Oct 4, 2023
1 parent 06d4db4 commit 1b9287a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 337 deletions.
60 changes: 0 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1451,66 +1451,6 @@ val h: Unit > IOs =
doubleAdder.map(_.reset)
```

## ZIOs: ZIO Integration

Kyo offers interoperability with [ZIO](https://zio.dev/) through its `kyo-zio` module. This integration allows developers to naturally lift ZIO computations into Kyo and work with them using Kyo's API while harnessing ZIO's capabilities underneath.

```scala
import kyo.zios._
import zio._

// An example service
trait Service {
def compute: Int
}

// An example ZIO computation
val a: ZIO[Service, String, Int] =
ZIO.accessM[Service](service => ZIO.effect(service.compute))

// Convert ZIO computation with environment
// and error channels to Kyo
val b: Int > (Envs[Service] with Aborts[String] with ZIOs) =
ZIOs.fromZIO(serviceComputation)

// An example 'Task'
val c: Task[Int] =
ZIO.effectTotal(42)

// Use 'fromTask' to lift a computation that
// doesn't have error and environment requirements
val d: Int > ZIOs =
ZIOs.fromTask(simpleTask)

// An example 'IO'
val e: IO[String, Int] =
ZIO.fail("An error!")

// Use 'fromIO' to lift a computation that
// doesn't have specified errors
val f: Int > (Aborts[String] with ZIOs) =
ZIOs.fromIO(f)
```

> Note: The integration properly handles fibers to propagate interruption between the Kyo's and ZIO's runtimes. `Locals` aren't propagated between the libraries.
The `kyo.ZiosApp` abstract class provides a version of `kyo.App` that automatically handles the `ZIOs` effect:

```scala
object MyZiosApp extends ZiosApp {

def run(args: List[String]) =
for {
fiber1 <- Fibers.forkFiber(Math.cos(42))
fiber2 <- ZIOs.fromTask(ZIO.attempt(Math.sin(42)).fork)
_ <- fiber1.get
_ <- ZIOs.fromTask(fiber2.join)
} yield ()
}
```

The `ZIOs.run` method can also be used to directly handle the `ZIOs` effect but it should be avoided.

License
-------

Expand Down
15 changes: 0 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ lazy val kyo =
).aggregate(
`kyo-core`,
`kyo-core-opt`,
`kyo-zio`,
`kyo-direct`,
`kyo-sttp`,
`kyo-chatgpt`,
Expand Down Expand Up @@ -163,19 +162,6 @@ lazy val `kyo-direct` =
)
.jsSettings(`js-settings`)

lazy val `kyo-zio` =
crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("kyo-zio"))
.dependsOn(`kyo-core` % "test->test;compile->compile")
.settings(
`kyo-settings`,
`with-cross-scala`,
libraryDependencies += "dev.zio" %%% "zio" % zioVersion
)
.jsSettings(`js-settings`)

lazy val `kyo-sttp` =
crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
Expand Down Expand Up @@ -257,7 +243,6 @@ lazy val readme =
)
.dependsOn(
`kyo-core`,
`kyo-zio`,
`kyo-direct`,
`kyo-sttp`,
`kyo-chatgpt`,
Expand Down
63 changes: 0 additions & 63 deletions kyo-zio/src/main/scala/kyo/ZiosApp.scala

This file was deleted.

91 changes: 0 additions & 91 deletions kyo-zio/src/main/scala/kyo/zios.scala

This file was deleted.

108 changes: 0 additions & 108 deletions kyo-zio/src/test/scala/kyoTest/ziosTest.scala

This file was deleted.

0 comments on commit 1b9287a

Please sign in to comment.