PlatedLaws

dev.constructive.eo.laws.PlatedLaws
trait PlatedLaws[S](using val P: Plated[S])

Law equations for a dev.constructive.eo.optics.Plated instance.

These are the unconditional checks — they hold for any S and validate the three moving parts at once: the self-traversal plate (round-trips), transform (identity-preserving), and universe / children (mutually consistent). Running them on a macro-derived plate[S] is the primary correctness signal for the derivation; rewrite needs a terminating rule and so is exercised behaviourally instead of here.

equals is used for the comparisons, so S must have structural equality (every case class / enum does; io.circe.Json does too).

Attributes

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

Members list

Value members

Concrete methods

The number of immediate children equals the focus count the self-traversal reports.

The number of immediate children equals the focus count the self-traversal reports.

Attributes

Source
PlatedLaws.scala
def plateModifyIdentity(s: S): Boolean

The self-traversal round-trips: writing each child back unchanged is the identity. This is the law that catches a broken derivation (wrong child set, mis-ordered rebuild).

The self-traversal round-trips: writing each child back unchanged is the identity. This is the law that catches a broken derivation (wrong child set, mis-ordered rebuild).

Attributes

Source
PlatedLaws.scala
def transformIdentity(s: S): Boolean

A no-op rewrite over the whole tree is the identity.

A no-op rewrite over the whole tree is the identity.

Attributes

Source
PlatedLaws.scala
def universeDecomposition(s: S): Boolean

universe is s followed by the pre-order universe of each immediate child — ties the stack-safe worklist implementation to children.

universe is s followed by the pre-order universe of each immediate child — ties the stack-safe worklist implementation to children.

Attributes

Source
PlatedLaws.scala

Givens

Givens

given P: Plated[S]

Attributes

Source
PlatedLaws.scala