← ZIO Prelude docs

Equivalence

zio.prelude.Equivalence
See theEquivalence companion object
trait Equivalence[A, B] extends PartialEquivalence[A, B, Nothing, Nothing]

An Equivalence[A, B] defines an equivalence between two types A and B. These types represent different ways to store the same information.

For example, a List[Byte] is equivalent to a Vector[Byte]. Similarly, a List[Char] is equivalent to a String.

Equivalences are symmetrical. So if A is equivalent to B, then B is equivalent to A.

Value parameters

from

A function that converts a B into an A.

to

A function that converts an A into a B.

Attributes

Companion
object
Source
Equivalence.scala
Graph
Supertypes
trait PartialEquivalence[A, B, Nothing, Nothing]
class Object
trait Matchable
class Any
Self type
Equivalence[A, B]

Members list

Value members

Abstract methods

def from: B => A

Attributes

Source
Equivalence.scala
def to: A => B

Attributes

Source
Equivalence.scala

Concrete methods

def >>>[C](that: Equivalence[B, C]): Equivalence[A, C]

Composes this equivalence with the specified equivalence.

Composes this equivalence with the specified equivalence.

Attributes

Source
Equivalence.scala
def andThen[C](that: Equivalence[B, C]): Equivalence[A, C]

A named method for >>>.

A named method for >>>.

Attributes

Source
Equivalence.scala
def compose[C](that: Equivalence[C, A]): Equivalence[C, B]

Attributes

Source
Equivalence.scala
override def flip: Equivalence[B, A]

Flips this equivalence around.

Flips this equivalence around.

Attributes

Definition Classes
Source
Equivalence.scala
final def fromPartial: B => Either[Nothing, A]

Attributes

Source
Equivalence.scala
final def toPartial: A => Either[Nothing, B]

Attributes

Source
Equivalence.scala

Inherited methods

def >>>[C, E3, E4](that: PartialEquivalence[B, C, E3, E4]): PartialEquivalence[A, C, E3, E4]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala
def andThen[C, E3, E4](that: PartialEquivalence[B, C, E3, E4]): PartialEquivalence[A, C, E3, E4]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala
def canonicalLeft(a: A): Option[A]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala
def canonicalLeftOrError[E](a: A)(implicit ev1: Nothing <:< E, ev2: Nothing <:< E): Either[E, A]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala
def canonicalRight(b: B): Option[B]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala
def canonicalRightOrError[E](b: B)(implicit ev1: Nothing <:< E, ev2: Nothing <:< E): Either[E, B]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala
def compose[C, E3, E4](that: PartialEquivalence[C, A, E3, E4]): PartialEquivalence[C, B, E3, E4]

Attributes

Inherited from:
PartialEquivalence
Source
PartialEquivalence.scala