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.

Monocle's getAll / headOption laws are not restated here: EO's Optic.all (Monocle's getAll) is foldMap(List(_)) for every fold-capable carrier, pinned once by E2 allIsFoci in eo.FoldMapHomomorphismLaws, and headOption rides on the same foldMap.

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