ModifyLaws

dev.constructive.eo.laws.ModifyLaws
trait ModifyLaws[S, A]

Law equations for a Modify[S, A]Optic[S, S, A, A, ModifyF].

Ported from Monocle's monocle.law.SetterLaws. Modify optics have no get, so the four laws are modify-only: identity, composition, replace idempotence, and the consistency of replace with modify(const a).

Attributes

Source
ModifyLaws.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def modify: Optic[S, S, A, A, ModifyF]

The optic under test.

The optic under test.

Attributes

Source
ModifyLaws.scala

Concrete methods

def composeModify(s: S, f: A => A, g: A => A): Boolean

modify(g) ∘ modify(f) == modify(f andThen g).

modify(g) ∘ modify(f) == modify(f andThen g).

Attributes

Source
ModifyLaws.scala
def consistentReplaceModify(s: S, a: A): Boolean

replace(a) == modify(_ => a).

replace(a) == modify(_ => a).

Attributes

Source
ModifyLaws.scala
def modifyIdentity(s: S): Boolean

modify(identity) == identity.

modify(identity) == identity.

Attributes

Source
ModifyLaws.scala
def replaceIdempotent(s: S, a: A): Boolean

put-put: replace(a) ∘ replace(a) == replace(a).

put-put: replace(a) ∘ replace(a) == replace(a).

Attributes

Source
ModifyLaws.scala