Skip to content

Commit 746ccff

Browse files
authored
Merge pull request #320 from vigoo/zio2
ZIO 2.0.0
2 parents 4ab118e + 4f29e11 commit 746ccff

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ lazy val zio2 = Project("clipp-zio-2", file("clipp-zio-2")).settings(commonSetti
104104
resolvers +=
105105
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
106106
libraryDependencies ++= Seq(
107-
"dev.zio" %% "zio" % "2.0.0-RC6",
108-
"dev.zio" %% "zio-test" % "2.0.0-RC6" % Test,
109-
"dev.zio" %% "zio-test-sbt" % "2.0.0-RC6" % Test
107+
"dev.zio" %% "zio" % "2.0.0",
108+
"dev.zio" %% "zio-test" % "2.0.0" % Test,
109+
"dev.zio" %% "zio-test-sbt" % "2.0.0" % Test
110110
),
111111

112112
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
@@ -201,4 +201,4 @@ pomPostProcess := { (node: XmlNode) =>
201201
case _ => node
202202
}
203203
}).transform(node).head
204-
}
204+
}

clipp-zio-2/src/main/scala/io/github/vigoo/clipp/zioapi/package.scala

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.github.vigoo.clipp
22

33
import cats.data.NonEmptyList
44
import io.github.vigoo.clipp.errors.CustomParserError
5-
import zio.{CanFail, Console, Runtime, Tag, URIO, ZIO, ZIOAppArgs, ZLayer}
5+
import zio.{CanFail, Console, Runtime, Tag, Unsafe, URIO, ZIO, ZIOAppArgs, ZLayer}
66

77
package object zioapi {
88
type ClippEnv = Any
@@ -32,22 +32,30 @@ package object zioapi {
3232

3333
def liftZIO[R, E, T](description: String, examples: NonEmptyList[T])(f: ZIO[R, E, T])(implicit runtime: Runtime[R], ev: CanFail[E], customParserError: CustomParserError[E]): Parameter.Spec[T] =
3434
syntax.liftEither(description, examples) {
35-
runtime.unsafeRun(f.either)
35+
Unsafe.unsafeCompat { implicit u =>
36+
runtime.unsafe.run(f.either).getOrThrowFiberFailure()
37+
}
3638
}
3739

3840
def liftZIO[R, E, T](description: String, example: T)(f: ZIO[R, E, T])(implicit runtime: Runtime[R], ev: CanFail[E], customParserError: CustomParserError[E]): Parameter.Spec[T] =
3941
syntax.liftEither(description, example) {
40-
runtime.unsafeRun(f.either)
42+
Unsafe.unsafeCompat { implicit u =>
43+
runtime.unsafe.run(f.either).getOrThrowFiberFailure()
44+
}
4145
}
4246

4347
def liftURIO[R, T](description: String, examples: NonEmptyList[T])(f: URIO[R, T])(implicit runtime: Runtime[R]): Parameter.Spec[T] =
44-
syntax.lift(description, examples) {
45-
runtime.unsafeRun(f)
48+
syntax.lift(description, examples) {
49+
Unsafe.unsafeCompat { implicit u =>
50+
runtime.unsafe.run(f).getOrThrowFiberFailure()
51+
}
4652
}
4753

4854
def liftURIO[R, T](description: String, example: T)(f: URIO[R, T])(implicit runtime: Runtime[R]): Parameter.Spec[T] =
4955
syntax.lift(description, example) {
50-
runtime.unsafeRun(f)
56+
Unsafe.unsafeCompat { implicit u =>
57+
runtime.unsafe.run(f).getOrThrowFiberFailure()
58+
}
5159
}
5260

5361
case class ZioDSL[R](runtime: Runtime[R]) extends syntax {

0 commit comments

Comments
 (0)