← ZIO Prelude docs

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
Source
Identity.scala
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

Source
Identity.scala
def identity: A

The identity element.

The identity element.

Attributes

Source
Identity.scala

Concrete methods

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

Attributes

Definition Classes
Source
Identity.scala

Inherited methods

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

Attributes

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

Attributes

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

Attributes

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

Attributes

Inherited from:
Associative
Source
Associative.scala

Inherited and Abstract methods

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

Attributes

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

Attributes

Inherited from:
Associative
Source
Associative.scala