diff --git a/kyo-chatgpt/jvm/src/main/scala/kyo/chatgpt/UI.scala b/kyo-chatgpt/jvm/src/main/scala/kyo/chatgpt/UI.scala index 7e07f0b9b..83a117759 100644 --- a/kyo-chatgpt/jvm/src/main/scala/kyo/chatgpt/UI.scala +++ b/kyo-chatgpt/jvm/src/main/scala/kyo/chatgpt/UI.scala @@ -187,7 +187,7 @@ object UI extends App { _ <- chan.put((message, enabledModes.toList, p)) r <- p.get } yield r - }.block + }.map(_.block) } } diff --git a/kyo-core/shared/src/main/scala/kyo/KyoApp.scala b/kyo-core/shared/src/main/scala/kyo/KyoApp.scala index ee12c4fea..89823c951 100644 --- a/kyo-core/shared/src/main/scala/kyo/KyoApp.scala +++ b/kyo-core/shared/src/main/scala/kyo/KyoApp.scala @@ -11,22 +11,25 @@ import randoms._ import concurrent.fibers._ import concurrent.timers._ import scala.concurrent.duration.Duration +import kyo.KyoApp.Effects abstract class KyoApp { final def main(args: Array[String]): Unit = - IOs.run(KyoApp.runFiber(Duration.Inf)(run(args.toList)).block) + IOs.run(KyoApp.runFiber(Duration.Inf)(run(args.toList)).map(_.block)) def run( args: List[String] - ): Unit > (IOs with Fibers with Resources with Clocks with Consoles with Randoms with Timers with Aspects) + ): Unit > Effects } object KyoApp { - def runFiber[T](timeout: Duration)( - v: T > (IOs with Fibers with Resources with Clocks with Consoles with Randoms with Timers with Aspects) - ): Fiber[T] = { + + type Effects = + IOs with Fibers with Resources with Clocks with Consoles with Randoms with Timers with Aspects + + def runFiber[T](timeout: Duration)(v: T > Effects): Fiber[T] > IOs = { val v1 : T > (IOs with Fibers with Resources with Clocks with Consoles with Timers with Aspects) = Randoms.run(v) @@ -38,7 +41,6 @@ object KyoApp { val v6: T > (IOs with Fibers) = Timers.run(v5) val v7: T > (IOs with Fibers with Timers) = Fibers.timeout(timeout)(v6) val v8: T > (IOs with Fibers) = Timers.run(v6) - val v9: Fiber[T] > IOs = Fibers.run(IOs.runLazy(v8)) - IOs.run(v9) + IOs(Fibers.run(IOs.runLazy(v8))) } } diff --git a/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala b/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala index a7eafad9d..b397fddeb 100644 --- a/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala +++ b/kyo-core/shared/src/test/scala/kyoTest/KyoTest.scala @@ -72,7 +72,7 @@ class KyoTest extends AsyncFreeSpec with Assertions { def run( v: => Assertion > (IOs with Fibers with Resources with Clocks with Consoles with Randoms with Timers) ): Future[Assertion] = { - IOs.run(KyoApp.runFiber(timeout)(v).toFuture) + IOs.run(KyoApp.runFiber(timeout)(v).map(_.toFuture)) } class Check[T, S](equals: Boolean) {