SeamLaws

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

Laws that exercise an Optional's WRITE SEAM — the generic Optic.modify / Optic.replace (from(map(to(s), _))), the path an UPCAST or COMPOSED write actually takes, NOT any concrete-class convenience surface that might sidestep from.

'''Run these on a DRILLED / partial-cover optic''' — a focus with surrounding context (a field of a larger record, an element beside siblings). A carrier whose from reconstructs the focus STANDALONE (dropping the context) fails seamModifyIdentity here, even though a full-cover fixture passes it trivially. That is precisely the class of bug the full-cover-only Prism / Optional discipline suites could never catch — the 2026-07 avro/circe record-face sibling-drop: Either-carried drilled prisms whose from(Right(b)) = reverseGet(b) threw the siblings away on every composed / upcast write. This law makes that failure loud for any carrier.

Equality is INJECTED because some carriers' S has no lawful universal ==: avro IndexedRecord uses schema-instance-sensitive equals, so pass a structural comparison; circe Json and most value types can pass _ == _.

Attributes

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

Members list

Value members

Abstract methods

def eqv: (S, S) => Boolean

Structural equality on S.

Structural equality on S.

Attributes

Source
SeamLaws.scala
def optic: Optic[S, S, A, A, Affine]

The optic under test, as its BARE Optic supertype — so .modify / .replace resolve to the generic seam extension, not a shadowing member.

The optic under test, as its BARE Optic supertype — so .modify / .replace resolve to the generic seam extension, not a shadowing member.

Attributes

Source
SeamLaws.scala

Concrete methods

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

compose-modify through the seam.

compose-modify through the seam.

Attributes

Source
SeamLaws.scala
def seamModifyIdentity(s: S): Boolean

get-put through the seam: a no-op modify must round-trip the WHOLE structure, context included. The sibling-drop bug fails exactly here on a drilled optic.

get-put through the seam: a no-op modify must round-trip the WHOLE structure, context included. The sibling-drop bug fails exactly here on a drilled optic.

Attributes

Source
SeamLaws.scala
def seamReplaceOverwrite(s: S, a1: A, a2: A): Boolean

put-put through the seam: the last replace wins, with the surrounding context preserved.

put-put through the seam: the last replace wins, with the surrounding context preserved.

Attributes

Source
SeamLaws.scala