Differ

zio.Differ
See theDiffer companion object
trait Differ[Value, Patch] extends Serializable

A Differ[Value, Patch] knows how to compare an old value and new value of type Value to produce a patch of type Patch that describes the differences between those values. A Differ also knows how to apply a patch to an old value to produce a new value that represents the old value updated with the changes described by the patch.

A Differ can be used to construct a FiberRef supporting compositional updates using the FiberRef.makePatch constructor.

The Differ companion object contains constructors for Differ values for common data types such as Chunk, Map, and Set``. In addition,Differvalues can be transformed using thetransformoperator and combined using theorElseEitherandzipoperators. This allows creatingDiffer` values for arbitrarily complex data types compositionally.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Differ[Value, Patch]

Members list

Concise view

Value members

Abstract methods

def combine(first: Patch, second: Patch): Patch

Combines two patches to produce a new patch that describes the updates of the first patch and then the updates of the second patch. The combine operation should be associative. In addition, if the combine operation is commutative then joining multiple fibers concurrently will result in deterministic FiberRef values.

Combines two patches to produce a new patch that describes the updates of the first patch and then the updates of the second patch. The combine operation should be associative. In addition, if the combine operation is commutative then joining multiple fibers concurrently will result in deterministic FiberRef values.

Attributes

def diff(oldValue: Value, newValue: Value): Patch

Constructs a patch describing the updates to a value from an old value and a new value.

Constructs a patch describing the updates to a value from an old value and a new value.

Attributes

def empty: Patch

An empty patch that describes no changes.

An empty patch that describes no changes.

Attributes

def patch(patch: Patch)(oldValue: Value): Value

Applies a patch to an old value to produce a new value that is equal to the old value with the updates described by the patch.

Applies a patch to an old value to produce a new value that is equal to the old value with the updates described by the patch.

Attributes

Concrete methods

final def <*>[Value2, Patch2](that: Differ[Value2, Patch2]): Differ[(Value, Value2), (Patch, Patch2)]

A symbolic alias for zip.

A symbolic alias for zip.

Attributes

final def <+>[Value2, Patch2](that: Differ[Value2, Patch2]): Differ[Either[Value, Value2], OrPatch[Value, Value2, Patch, Patch2]]

A symbolic alias for orElseEither.

A symbolic alias for orElseEither.

Attributes

final def orElseEither[Value2, Patch2](that: Differ[Value2, Patch2]): Differ[Either[Value, Value2], OrPatch[Value, Value2, Patch, Patch2]]

Combines this differ and the specified differ to produce a differ that knows how to diff the sum of their values.

Combines this differ and the specified differ to produce a differ that knows how to diff the sum of their values.

Attributes

final def transform[Value2](f: Value => Value2, g: Value2 => Value): Differ[Value2, Patch]

Transforms the type of values that this differ knows how to differ using the specified functions that map the new and old value types to each other.

Transforms the type of values that this differ knows how to differ using the specified functions that map the new and old value types to each other.

Attributes

final def zip[Value2, Patch2](that: Differ[Value2, Patch2]): Differ[(Value, Value2), (Patch, Patch2)]

Combines this differ and the specified differ to produce a new differ that knows how to diff the product of their values.

Combines this differ and the specified differ to produce a new differ that knows how to diff the product of their values.

Attributes