IsoLaws

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

Law equations for an Iso[S, A]Optic[S, S, A, A, Direct].

Ported from Monocle's monocle.law.IsoLaws. Where Monocle spells iso.get(s) / iso.reverseGet(a) directly, EO's iso is an Optic whose Direct carrier yields the same operations through the Accessor / ReverseAccessor extensions. The content of the laws is identical; only the carrier spelling changes.

modifyIdentity / composeModify for Iso are direct corollaries of the two round-trip laws (modify = from ∘ f ∘ to), so this trait does not enumerate them separately. They are also awkward to express with EO's existential encoding because the Direct type alias has no Bifunctor, so it does not reach the generic ForgetfulFunctor derivation that the modify extension drives off.

Attributes

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

Members list

Value members

Abstract methods

def iso: Optic[S, S, A, A, Direct]

The optic under test.

The optic under test.

Attributes

Source
IsoLaws.scala

Concrete methods

def roundTripOneWay(s: S): Boolean

reverseGet(get(s)) == s — deconstruct-then-rebuild is the identity on S.

reverseGet(get(s)) == s — deconstruct-then-rebuild is the identity on S.

Attributes

Source
IsoLaws.scala
def roundTripOtherWay(a: A): Boolean

get(reverseGet(a)) == a — rebuild-then-deconstruct is the identity on A.

get(reverseGet(a)) == a — rebuild-then-deconstruct is the identity on A.

Attributes

Source
IsoLaws.scala