dev.constructive.eo.laws.discipline
Discipline RuleSet bundles for the optic-family laws in dev.constructive.eo.laws — one *Tests class per optic shape. Each is an ''abstract class'' wired by overriding its laws member (no companion apply), then asking for the family's rule set:
checkAll(
"Lens[(Int,String), Int] — first projection",
new LensTests[(Int, String), Int]:
val laws = new LensLaws[(Int, String), Int]:
val lens = firstLens
.lens,
)
Pick the rule set by the optic's CARRIER, not its constructor: Tuple2 → LensTests, full-cover Either → PrismTests, Affine → OptionalTests (or AffineFoldTests for the read-only face). And ALWAYS run SeamTests on a DRILLED / partial-cover optic of the carrier — full-cover fixtures pass its write-seam laws trivially and miss the sibling-drop bug class.
checkAll comes from org.typelevel:discipline-specs2 (the Discipline trait — a test-side dependency your suite adds), and every rule-set method takes YOUR Arbitrary / Cogen givens: this module ships no generators.
Attributes
Members list
Type members
Classlikes
Discipline RuleSet for AffineFoldLaws.
Discipline RuleSet for AffineFoldLaws.
Attributes
- Source
- AffineFoldTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for FoldLaws.
Discipline RuleSet for FoldLaws.
Attributes
- Source
- FoldTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for GetterLaws.
Discipline RuleSet for GetterLaws.
Attributes
- Source
- GetterTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for IsoLaws.
Discipline RuleSet for IsoLaws.
Attributes
- Source
- IsoTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for LensLaws.
Discipline RuleSet for LensLaws.
'''Hierarchy:''' inherits the four modify-tier props from internal.ReplaceLawsTests and adds the two get/replace round-trip props (getReplace, replaceGet) that distinguish a Lens from a Modify / Traversal.
Attributes
- Source
- LensTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for ModifyLaws.
Discipline RuleSet for ModifyLaws.
'''Hierarchy:''' Modify is the pure modify-tier law family — its props are exactly the four shared with Lens / Traversal. The body adds nothing on top of internal.ReplaceLawsTests; it just declares the parent and renames the resulting ruleSet to "Modify".
Attributes
- Source
- ModifyTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for MultiFocusLaws. The classifier F[_] flows in from the laws field — each concrete checkAll wiring pins it to List, Option, ZipList, Const[M, *], etc.
Discipline RuleSet for MultiFocusLaws. The classifier F[_] flows in from the laws field — each concrete checkAll wiring pins it to List, Option, ZipList, Const[M, *], etc.
MF3 (collect via map) needs S =:= F[A] evidence to reach the focus — the generic MultiFocus.apply[F, A] factory witnesses exactly this equality. A Cogen[F[A]] is required to generate F[A] => A aggregator functions; callers pass it explicitly per instance because generic Cogen[F[A]] derivation isn't available for ZipList / Const out of the box.
Attributes
- Source
- MultiFocusTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for NavigationLaws — the two equations every untyped-tree navigation kit promises and none of the stock suites check: put-get on a hit, and write-is-a-no-op on a miss. Instantiate per kit alongside OptionalTests (read tier) and SeamTests (drilled write seam), with a generator that produces BOTH hits and misses.
Discipline RuleSet for NavigationLaws — the two equations every untyped-tree navigation kit promises and none of the stock suites check: put-get on a hit, and write-is-a-no-op on a miss. Instantiate per kit alongside OptionalTests (read tier) and SeamTests (drilled write seam), with a generator that produces BOTH hits and misses.
Attributes
- Source
- NavigationTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for OptionalLaws.
Discipline RuleSet for OptionalLaws.
'''Hierarchy:''' inherits the three partial-read props from internal.PartialReadLawsTests (modify identity, compose modify, consistent getOption / modify-id). Optional adds nothing unique on top — the partial-read tier captures its full law surface.
Attributes
- Source
- OptionalTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for PlatedLaws. Reusable by downstream projects to re-check the Plated laws on their own recursive types (hand-written or macro-derived plate).
Discipline RuleSet for PlatedLaws. Reusable by downstream projects to re-check the Plated laws on their own recursive types (hand-written or macro-derived plate).
Attributes
- Source
- PlatedTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for PrismLaws.
Discipline RuleSet for PrismLaws.
'''Hierarchy:''' inherits the three partial-read props from internal.PartialReadLawsTests and adds the two reverseGet round-trip props (partial round trip one way and round trip other way) that are specific to Prism.
Attributes
- Source
- PrismTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for SeamLaws — the write-seam round-trips (modify(identity), compose modify, replace overwrite) that must hold when an optic's generic .modify / .replace is exercised on a DRILLED / partial-cover optic. Instantiate one per carrier with a drilled optic and a structural eqv; the buggy sibling-dropping carriers fail seam modify identity / seam replace overwrite.
Discipline RuleSet for SeamLaws — the write-seam round-trips (modify(identity), compose modify, replace overwrite) that must hold when an optic's generic .modify / .replace is exercised on a DRILLED / partial-cover optic. Instantiate one per carrier with a drilled optic and a structural eqv; the buggy sibling-dropping carriers fail seam modify identity / seam replace overwrite.
Attributes
- Source
- SeamTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSet for TraversalLaws.
Discipline RuleSet for TraversalLaws.
'''Hierarchy:''' Traversal is also pure modify-tier — the four props are inherited verbatim from internal.ReplaceLawsTests, with no Traversal-specific extras at this layer (the fold-side foldMap laws live in dev.constructive.eo.laws.eo.discipline.FoldMapHomomorphismTests and dev.constructive.eo.laws.eo.discipline.ModifyAConstTests instead).
Attributes
- Source
- TraversalTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any
Discipline RuleSets for UnfoldLaws. unfold is the core set every unfold satisfies (Functor[F] suffices — pattern-functor algebras included); unfoldApplicative extends it with the vestigial-read degradation law that only Unfold.apply-built (Applicative-carrier) unfolds can state.
Discipline RuleSets for UnfoldLaws. unfold is the core set every unfold satisfies (Functor[F] suffices — pattern-functor algebras included); unfoldApplicative extends it with the vestigial-read degradation law that only Unfold.apply-built (Applicative-carrier) unfolds can state.
Attributes
- Source
- UnfoldTests.scala
- Supertypes
-
trait Lawsclass Objecttrait Matchableclass Any