Skip to content

Commit

Permalink
Merge pull request #320 from vigoo/zio2
Browse files Browse the repository at this point in the history
ZIO 2.0.0
  • Loading branch information
vigoo authored Jun 24, 2022
2 parents 4ab118e + 4f29e11 commit 746ccff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ lazy val zio2 = Project("clipp-zio-2", file("clipp-zio-2")).settings(commonSetti
resolvers +=
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % "2.0.0-RC6",
"dev.zio" %% "zio-test" % "2.0.0-RC6" % Test,
"dev.zio" %% "zio-test-sbt" % "2.0.0-RC6" % Test
"dev.zio" %% "zio" % "2.0.0",
"dev.zio" %% "zio-test" % "2.0.0" % Test,
"dev.zio" %% "zio-test-sbt" % "2.0.0" % Test
),

testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
Expand Down Expand Up @@ -201,4 +201,4 @@ pomPostProcess := { (node: XmlNode) =>
case _ => node
}
}).transform(node).head
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.vigoo.clipp

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

package object zioapi {
type ClippEnv = Any
Expand Down Expand Up @@ -32,22 +32,30 @@ package object zioapi {

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] =
syntax.liftEither(description, examples) {
runtime.unsafeRun(f.either)
Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(f.either).getOrThrowFiberFailure()
}
}

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] =
syntax.liftEither(description, example) {
runtime.unsafeRun(f.either)
Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(f.either).getOrThrowFiberFailure()
}
}

def liftURIO[R, T](description: String, examples: NonEmptyList[T])(f: URIO[R, T])(implicit runtime: Runtime[R]): Parameter.Spec[T] =
syntax.lift(description, examples) {
runtime.unsafeRun(f)
syntax.lift(description, examples) {
Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(f).getOrThrowFiberFailure()
}
}

def liftURIO[R, T](description: String, example: T)(f: URIO[R, T])(implicit runtime: Runtime[R]): Parameter.Spec[T] =
syntax.lift(description, example) {
runtime.unsafeRun(f)
Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(f).getOrThrowFiberFailure()
}
}

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

0 comments on commit 746ccff

Please sign in to comment.