All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
zio.test.CheckConstructor.scala Maven / Gradle / Ivy
package zio.test
import zio.{Scope, ZIO, Trace}
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.stm.ZSTM
trait CheckConstructor[Environment, In] {
type OutEnvironment <: Environment
type OutError
def apply(input: => In)(implicit trace: Trace): ZIO[OutEnvironment, OutError, TestResult]
}
object CheckConstructor extends CheckConstructorLowPriority1 {
type WithOut[Environment, In, OutEnvironment0, OutError0] =
CheckConstructor[Environment, In] {
type OutEnvironment = OutEnvironment0
type OutError = OutError0
}
implicit def AssertConstructor[R, A <: TestResult]: CheckConstructor.WithOut[R, A, R, Nothing] =
new CheckConstructor[R, A] {
type OutEnvironment = R
type OutError = Nothing
def apply(input: => A)(implicit trace: Trace): ZIO[OutEnvironment, OutError, TestResult] =
ZIO.succeed(input)
}
}
trait CheckConstructorLowPriority1 extends CheckConstructorLowPriority2 {
implicit def AssertZIOConstructor[R, R1, E, A <: TestResult]
: CheckConstructor.WithOut[R, ZIO[R1, E, A], R with R1, E] =
new CheckConstructor[R, ZIO[R1, E, A]] {
type OutEnvironment = R with R1
type OutError = E
def apply(input: => ZIO[R1, E, A])(implicit trace: Trace): ZIO[OutEnvironment, OutError, TestResult] =
input
}
}
trait CheckConstructorLowPriority2 {
implicit def AssertZSTMConstructor[R, R1, E, A <: TestResult]
: CheckConstructor.WithOut[R, ZSTM[R1, E, A], R with R1, E] =
new CheckConstructor[R, ZSTM[R1, E, A]] {
type OutEnvironment = R with R1
type OutError = E
def apply(input: => ZSTM[R1, E, A])(implicit trace: Trace): ZIO[OutEnvironment, OutError, TestResult] =
input.commit
}
}