Identity

zio.prelude.Identity
See theIdentity companion object
trait Identity[A] extends Associative[A]

The Identity type class describes an associative binary operator for a type A that also has an identity element. Combining any value with the identity element on either the left or the right must return the original value unchanged. For example, zero is an identity element for integer addition and the empty string is an identity element for string concatenation.

Operators with an identity element are useful because the identity element provides a sensible default value when combining values of a type and no values exist.

Attributes

Companion
object
Graph
Supertypes
trait Associative[A]
class Object
trait Matchable
class Any
Known subtypes
trait EqualIdentity[A]
trait EqualInverse[A]
trait PartialInverse[A]
trait Inverse[A]
Show all

Members list

Value members

Abstract methods

def identity: A
Implicitly added by EitherIdentity

The identity element.

The identity element.

Attributes

def identity: A

The identity element.

The identity element.

Attributes

Concrete methods

override def multiplyOption(n: Int)(a: A): Option[A]

Attributes

Definition Classes

Inherited methods

def combine(l: => A, r: => A): A
Implicitly added by EitherIdentity

Attributes

Inherited from:
Associative
def combine(l: => A, r: => A): A

Attributes

Inherited from:
Associative
final def intersperse(middle: A): Associative[A]
Implicitly added by EitherIdentity

Attributes

Inherited from:
Associative
final def intersperse(middle: A): Associative[A]

Attributes

Inherited from:
Associative
final def repeat(a: A)(n: Int): A
Implicitly added by EitherIdentity

Attributes

Inherited from:
Associative
final def repeat(a: A)(n: Int): A

Attributes

Inherited from:
Associative