tofu.syntax.monoid.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tofu-core_2.13 Show documentation
Show all versions of tofu-core_2.13 Show documentation
Opinionated Set of tool for functional programming in scala
package tofu.syntax
import cats.syntax.SemigroupSyntax
import cats.{Monoid, Semigroup}
object monoid extends SemigroupSyntax {
def empty[A](implicit A: Monoid[A]): A = A.empty
implicit class TofuSemigroupOps[A](private val lhs: A) extends AnyVal {
def |+|(rhs: A)(implicit A: Semigroup[A]): A = A.combine(lhs, rhs)
def combine(rhs: A)(implicit A: Semigroup[A]): A = A.combine(lhs, rhs)
def combineN(rhs: Int)(implicit A: Semigroup[A]): A = A.combineN(lhs, rhs)
}
}