Trait/Object

zio.prelude

Idempotent

Related Docs: object Idempotent | package prelude

Permalink

trait Idempotent[A] extends Associative[A]

The Idempotent type class describes a binary operator for a type A that is both associative and produces the same value when combining two identical values. This means that a <> a is equal to a for all values a. 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.

Self Type
Idempotent[A]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Idempotent
  2. Associative
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def combine(l: ⇒ A, r: ⇒ A): A

    Permalink
    Definition Classes
    Associative

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def combineIdempotent(l: ⇒ A, r: ⇒ A)(implicit A: Equal[A]): A

    Permalink

    If the values are equal, it doesn't attempt to combine them and promptly returns the first one.

    If the values are equal, it doesn't attempt to combine them and promptly returns the first one. If not equal, the values are combined normally.

  7. def combineNormal(l: ⇒ A, r: ⇒ A): A

    Permalink
    Attributes
    protected
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. def idempotent(implicit A: Equal[A]): Idempotent[A]

    Permalink

    Creates a new instance which internally uses combineIdempotent for combining values.

  14. final def intersperse(middle: A): Associative[A]

    Permalink
    Definition Classes
    Associative
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def multiplyOption(n: Int)(a: A): Option[A]

    Permalink
    Definition Classes
    Associative
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def repeat(a: A)(n: Int): A

    Permalink
    Definition Classes
    Associative
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Associative[A]

Inherited from AnyRef

Inherited from Any

Ungrouped