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

cats.syntax.semigroup.scala Maven / Gradle / Ivy

The newest version!
package cats
package syntax

trait SemigroupSyntax {
  // TODO: use simulacrum instances eventually
  implicit final def catsSyntaxSemigroup[A: Semigroup](a: A): SemigroupOps[A] =
    new SemigroupOps[A](a)
}

final class SemigroupOps[A: Semigroup](lhs: A) {
  def |+|(rhs: A): A = Semigroup[A].combine(lhs, rhs)
  def combine(rhs: A): A = Semigroup[A].combine(lhs, rhs)
  def combineN(rhs: Int): A = Semigroup[A].combineN(lhs, rhs)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy