trait
Idempotent[A] extends Associative[A]
Abstract Value Members
-
abstract
def
combine(l: ⇒ A, r: ⇒ A): A
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
combineIdempotent(l: ⇒ A, r: ⇒ A)(implicit A: Equal[A]): A
-
def
combineNormal(l: ⇒ A, r: ⇒ A): A
-
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
def
idempotent(implicit A: Equal[A]): Idempotent[A]
-
final
def
intersperse(middle: A): Associative[A]
-
final
def
isInstanceOf[T0]: Boolean
-
def
multiplyOption(n: Int)(a: A): Option[A]
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
repeat(a: A)(n: Int): A
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
The
Idempotent
type class describes a binary operator for a typeA
that is both associative and produces the same value when combining two identical values. This means thata <> a
is equal toa
for all valuesa
. Example of idempotent operations is union of sets, but not addition of integers.Idempotent operators are useful because combining the values with an idempotent operation results in the same value regardless of the number of values are combined, allowing us to optimize out unnecessary combinations of the same values.