dev.constructive.eo.compose
The composition seam: AssociativeFunctor powers the generic Optic.andThen (threading an inner carrier through an outer one), Composer names the carrier-pair-specific fusions, Morph re-expresses an optic over a different carrier so cross-carrier andThen can pick a direction, and ReadCompose routes read-only collapses (getter ∘ getter and friends) without building intermediate structure.
Attributes
Members list
Type members
Classlikes
Composition algebra for a two-parameter carrier F[_, _]. composeTo threads the focus through inner ∘ outer to produce F[Z, C]; composeFrom unfolds it back. Xo / Xi are the outer / inner optics' existentials; named distinct from Optic#X so composeTo / composeFrom can refinement-type on them. Carriers can specialise by pattern-matching on the outer / inner arguments.
Composition algebra for a two-parameter carrier F[_, _]. composeTo threads the focus through inner ∘ outer to produce F[Z, C]; composeFrom unfolds it back. Xo / Xi are the outer / inner optics' existentials; named distinct from Optic#X so composeTo / composeFrom can refinement-type on them. Carriers can specialise by pattern-matching on the outer / inner arguments.
Type parameters
- F
-
carrier
- Xi
-
inner-optic existential
- Xo
-
outer-optic existential
Attributes
- Companion
- object
- Source
- AssociativeFunctor.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Typeclass instances for AssociativeFunctor.
Typeclass instances for AssociativeFunctor.
Attributes
- Companion
- trait
- Source
- AssociativeFunctor.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
AssociativeFunctor.type
Typeclass instances for Composer. Additional composers live near the carrier they produce (e.g. Composer[Tuple2, Affine] in data.Affine).
Typeclass instances for Composer. Additional composers live near the carrier they produce (e.g. Composer[Tuple2, Affine] in data.Affine).
Resolution tiers:
- Regular: direct bridges here and in each carrier's companion.
- Low (from LowPriorityComposerInstances): chainViaTuple2 with
Tuple2as a fixed intermediate. Covers Direct-origin chains uniformly without introducing the implicit ambiguity the earlier fully-generalchain[F, G, H]had.
Attributes
- Companion
- trait
- Source
- Composer.scala
- Supertypes
- Self type
-
Composer.type
Bridge between carriers — reshape an F-carrier optic into a G-carrier optic. Used by Optic.morph; the mechanism by which optic families cross boundaries (Lens → Optional, Lens → Modify, Iso → Lens, …).
Bridge between carriers — reshape an F-carrier optic into a G-carrier optic. Used by Optic.morph; the mechanism by which optic families cross boundaries (Lens → Optional, Lens → Modify, Iso → Lens, …).
Type parameters
- F
-
source carrier
- G
-
target carrier
Attributes
- Companion
- object
- Source
- Composer.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object direct2eitherobject direct2tupleobject either2affineobject tuple2affineobject affine2modifyobject either2modifyobject tuple2modifyobject affine2multifocusPSVecobject either2multifocusPSVecobject tuple2multifocusPSVecShow all
Low-priority Composer instances — chainViaTuple2, a transitive derivation pinned to Tuple2 as the intermediate. Same runtime cost as the explicit 2-hop call; compile-time single given, no combinatorial enumeration; unambiguous by construction. Add a chainViaEither at a still-lower priority if a future carrier needs it.
Low-priority Composer instances — chainViaTuple2, a transitive derivation pinned to Tuple2 as the intermediate. Same runtime cost as the explicit 2-hop call; compile-time single given, no combinatorial enumeration; unambiguous by construction. Add a chainViaEither at a still-lower priority if a future carrier needs it.
Attributes
- Source
- Composer.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Composer
Low-priority Morph instances — consulted only when none of the higher-priority instances in Morph$ apply.
Low-priority Morph instances — consulted only when none of the higher-priority instances in Morph$ apply.
Attributes
- Source
- Morph.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Morph
Low-priority drawer for ReadCompose — the many-fold fallback.
Low-priority drawer for ReadCompose — the many-fold fallback.
Attributes
- Source
- ReadCompose.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object ReadCompose
Typeclass instances for Morph.
Typeclass instances for Morph.
Attributes
- Companion
- trait
- Source
- Morph.scala
- Supertypes
- Self type
-
Morph.type
Picks the direction to morph a pair of optics into a shared carrier so .andThen works across carriers. Four givens, decreasing priority:
Picks the direction to morph a pair of optics into a shared carrier so .andThen works across carriers. Four givens, decreasing priority:
- Morph.same — same carrier, no morph (
Out = F). - Morph.leftToRight — morph left into
GviaComposer[F, G](Out = G). - Morph.rightToLeft — morph right into
FviaComposer[G, F](Out = F). - LowPriorityMorphInstances.bothViaAffine — both into
Affinewhen neither bridges directly (covers e.g. Prism ∘ Lens).
cats-eo ships essentially one bidirectional Composer pair — forget2multifocus / multifocus2forget (the latter restricted to T = Unit). For every other carrier pair at most one of the first three fires; for that one pair a Forget[F] ⇄ MultiFocus[F] chain can be ambiguous, resolved by routing through the explicit Composer[..].to(o) form (see multifocus2forget's docstring).
Type parameters
- F
-
outer carrier
- G
-
inner carrier
Attributes
- Companion
- object
- Source
- Morph.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Typeclass instances for ReadCompose — the read-arity lattice. The four total/partial cells sit at normal priority; the many-fold fallback sits in LowPriorityReadCompose because carriers with an Accessor / PartialAccessor usually admit a ForgetfulFold too, and the stronger read must win.
Typeclass instances for ReadCompose — the read-arity lattice. The four total/partial cells sit at normal priority; the many-fold fallback sits in LowPriorityReadCompose because carriers with an Accessor / PartialAccessor usually admit a ForgetfulFold too, and the stronger read must win.
Attributes
- Companion
- trait
- Source
- ReadCompose.scala
- Supertypes
- Self type
-
ReadCompose.type
Read-side composition across the read/write seam — the join that AssociativeFunctor (which needs B-threading on a shared carrier) structurally cannot express. Composes the READ halves of two optics, ignoring both write sides, and lands at the read-only join of their strengths:
Read-side composition across the read/write seam — the join that AssociativeFunctor (which needs B-threading on a shared carrier) structurally cannot express. Composes the READ halves of two optics, ignoring both write sides, and lands at the read-only join of their strengths:
total ∘ total = Getter (Accessor ∘ Accessor)
total ∘ partial = AffineFold (any mix involving a PartialAccessor)
partial ∘ total = AffineFold
partial ∘ partial = AffineFold
many on either side = Fold (ForgetfulFold fallback, List-backed)
Drives the read-collapse andThen members: the Optic trait's any-outer ∘ read-only-inner overload and the read-only-outer ∘ any-inner members on optics.Getter / optics.PickFold / optics.ForgetFold. Instances live in this companion, so they are in implicit scope for every carrier pair with no import.
Type parameters
- F
-
outer optic's carrier
- G
-
inner optic's carrier
Attributes
- Companion
- object
- Source
- ReadCompose.scala
- Supertypes
-
class Objecttrait Matchableclass Any