All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zio.test.internal.OptionalImplicit.scala Maven / Gradle / Ivy

There is a newer version: 2.1.14
Show newest version
package zio.test.internal

import zio.stacktracer.TracingImplicits.disableAutoTrace

trait OptionalImplicit[A] {
  def value: Option[A]
}

object OptionalImplicit extends LowPriOptionalImplicit {
  def apply[A: OptionalImplicit]: Option[A] = implicitly[OptionalImplicit[A]].value

  implicit def some[A](implicit instance: A): OptionalImplicit[A] = new OptionalImplicit[A] {
    val value: Option[A] = Some(instance)
  }
}

trait LowPriOptionalImplicit {
  implicit def none[A]: OptionalImplicit[A] = new OptionalImplicit[A] {
    val value: Option[A] = None
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy