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

zio.prelude.experimental.Complement.scala Maven / Gradle / Ivy

There is a newer version: 1.0.0-RC34
Show newest version
package zio.prelude
package experimental

trait Complement[A] extends Absorption[A] {
  def complement(a: => A): A
}

object Complement {

  /**
   * Summons an implicit `Complement[A]`.
   */
  def apply[A](implicit complement: Complement[A]): Complement[A] = complement
}

trait ComplementSyntax {

  /**
   * Provides infix syntax for the Complement of the value.
   */
  implicit class ComplementOps[A](private val self: A)(implicit instance: Complement[A]) {

    /**
     * A symbolic alias for `complement`.
     */
    def unary_! : A =
      instance.complement(self)

    /**
     * The complement of the value.
     */
    def complement: A =
      instance.complement(self)

  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy