dev.constructive.eo.laws.typeclass
Laws for eo's composition typeclasses — AssociativeFunctor, Composer, ForgetfulFunctor, ForgetfulTraverse.
Attributes
Members list
Packages
Discipline RuleSet bundles for the typeclass laws in dev.constructive.eo.laws.typeclass.
Type members
Classlikes
Laws for dev.constructive.eo.compose.AssociativeFunctor. Operational, not category-theoretic: the "associative" part refers to packing Xo / Xi into Z, not monoidal structure.
Laws for dev.constructive.eo.compose.AssociativeFunctor. Operational, not category-theoretic: the "associative" part refers to packing Xo / Xi into Z, not monoidal structure.
- A1 compose-modify distributes:
composed.modify(f)(s) == outer.modify(inner.modify(f))(s). - A2 compose-modify identity: a Cogen-free specialisation of A1.
Both require ForgetfulFunctor[F] (every cats-eo AssociativeFunctor carrier also ships one).
Type parameters
- A
-
outer focus / inner source (mono A = B)
- C
-
inner focus (mono C = D)
- F
-
shared carrier
- S
-
outer source (mono S = T)
Attributes
- Source
- AssociativeFunctorLaws.scala
- Supertypes
-
class Objecttrait Matchableclass Any
C1 — path independence. An Iso → Affine via Tuple2 vs via Either should be modify-equivalent.
C1 — path independence. An Iso → Affine via Tuple2 vs via Either should be modify-equivalent.
Attributes
- Source
- ComposerLaws.scala
- Supertypes
-
class Objecttrait Matchableclass Any
C2 — chain preserves get whenever both ends have an Accessor.
C2 — chain preserves get whenever both ends have an Accessor.
Attributes
- Source
- ComposerLaws.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Law equations for any ForgetfulFunctor[F] instance — the usual two functor laws, stated in carrier-carrier form:
Law equations for any ForgetfulFunctor[F] instance — the usual two functor laws, stated in carrier-carrier form:
map(id) == idmap(g) ∘ map(f) == map(f andThen g)
Holds for every carrier EO uses: Tuple2, Either, Affine, ModifyF, Direct, Forget[F], MultiFocus[F]. The law trait is parameterised so downstream adding a new carrier can witness its ForgetfulFunctor instance here.
Equality is structural — if the carrier wraps a function (as ModifyF does), discipline-checking this law requires an extensional comparison. See dev.constructive.eo.laws.data.ModifyFLaws for that carrier-specific phrasing.
Attributes
- Source
- ForgetfulFunctorLaws.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Law equations for any ForgetfulTraverse[F, Applicative] — cats' Traverse laws restated for the two-parameter carrier, at fixed effects:
Law equations for any ForgetfulTraverse[F, Applicative] — cats' Traverse laws restated for the two-parameter carrier, at fixed effects:
- identity:
traverse[Id](fa)(a => a) == fa; - sequential composition: traversing under
Nested[List, Option]equals traversing underList, then each branch underOption; - parallel composition: traversing under
Tuple2K[List, Vector]equals the pair of the two separate traversals; - multi-shot agreement: traversing under
Listgives cats' cartesian productTraverse[List].traverse(foci)(f)over the carrier's foci (read offForgetfulFold), each choice written back intofa.
The effects are deliberately MULTI-SHOT (List, Vector resume every continuation once per branch; Tuple2K once per component): a traverse that threads one mutable result through map2 passes every single-shot law (Id, Option, Const) yet hands all branches the same result. The last law is the one that pins a branch to its values; the composition laws compare the carrier only with itself.
The [_ <: Distributive] flavour (ModifyF) is not covered: it collapses to a tautology at Id.
Attributes
- Source
- ForgetfulTraverseLaws.scala
- Supertypes
-
class Objecttrait Matchableclass Any