TraversalLaws

dev.constructive.eo.laws.TraversalLaws
trait TraversalLaws[T[_], A](using val FT: Functor[T])

Law equations for a Traversal[T[_], A]Optic[T[A], T[A], A, A, MultiFocus[PSVec]].

The MultiFocus[PSVec] carrier carries the right ForgetfulFunctor instance to drive the modify-side laws.

We deliberately do NOT port getAll / headOption here — EO's Optic.all returns the whole container wrapped in a single-element list (cartesian-product semantics from traverse(List(_))), not the individual elements, so Monocle's phrasing of those laws would not be testing what the name suggests.

Attributes

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

Members list

Value members

Abstract methods

def traversal: Optic[T[A], T[A], A, A, MultiFocus[PSVec]]

The optic under test.

The optic under test.

Attributes

Source
TraversalLaws.scala

Concrete methods

def composeModify(s: T[A], 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
TraversalLaws.scala
def consistentReplaceModify(s: T[A], a: A): Boolean

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

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

Attributes

Source
TraversalLaws.scala
def modifyIdentity(s: T[A]): Boolean

modify(identity) == identity.

modify(identity) == identity.

Attributes

Source
TraversalLaws.scala
def replaceIdempotent(s: T[A], a: A): Boolean

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

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

Attributes

Source
TraversalLaws.scala

Givens

Givens

given FT: Functor[T]

Attributes

Source
TraversalLaws.scala