Concrete Optic subclass for a read-only getter. A final class storing get directly — NOT an abstract class with an abstract get: the CI A/B showed composed-getter dispatch through the abstract-class form costs ~1.8x (eoGet_3 5.1ns final vs 11.5ns abstract) even with a fused andThen, while every fused path that stayed a concrete class (GetReplaceLens lens-reuse) was flat. The hot path skips the Accessor[Direct] dispatch the generic extension would perform — the same shape as BijectionIso / GetReplaceLens. Returned by Getter.apply so hand-written getters pick up the fused path automatically.
Attributes
- Companion
- object
- Source
- Getter.scala
- Graph
-
- Supertypes
Members list
Grouped members
Operations
Build-then-observe across the build-output ⇄ read-input seam, preserving structure, on a shared carrier F. Flip self (it must be reversible — Accessor[F] and ReverseAccessor[F], i.e. an Iso or Review over Direct) so it reads T from B, then andThen that under the same carrier. The result is the full Optic[B, A, C, D, F], not a collapsed getter: its read capability follows the carrier (.get for Direct), and self's read focus A survives as the composite's write-back focus.
Build-then-observe across the build-output ⇄ read-input seam, preserving structure, on a shared carrier F. Flip self (it must be reversible — Accessor[F] and ReverseAccessor[F], i.e. an Iso or Review over Direct) so it reads T from B, then andThen that under the same carrier. The result is the full Optic[B, A, C, D, F], not a collapsed getter: its read capability follows the carrier (.get for Direct), and self's read focus A survives as the composite's write-back focus.
This is exactly self.reverse.andThen(that). The motivating case is ana.cross(cata): a Review (the unfold) crossed with a getter on the built S (the fold) — a (materializing) hylomorphism whose .get reads the folded value. When that sits on a different carrier (a Prism, a Fold, …), the cross-carrier cross overload below is selected instead.
Seam: that's source is self's T and its back-type is self's S.
Attributes
- Inherited from:
- Optic
- Source
- Optic.scala
Type members
Types
Existential leftover carried alongside the focus — the type-level witness the carrier uses to rebuild T. Concrete at construction (Lens.apply sets X = S, Prism.apply sets X = S, …) and abstract when the optic is bound to Optic[…, F] without refinement.
Existential leftover carried alongside the focus — the type-level witness the carrier uses to rebuild T. Concrete at construction (Lens.apply sets X = S, Prism.apply sets X = S, …) and abstract when the optic is bound to Optic[…, F] without refinement.
Attributes
- Source
- Getter.scala
Value members
Concrete methods
Fused Getter.andThen(Getter) — composes the read functions; the vestigial Unit write path needs no threading.
Fused Getter.andThen(Getter) — composes the read functions; the vestigial Unit write path needs no threading.
inline so each composition call site splices its own copy of the s => inner.get(get(s)) lambda, yielding a distinct synthetic method per level. A plain def compiles the lambda once (andThen$$anonfun$1), so a depth-N runtime chain reuses that one bytecode and C2 treats the .get cascade as recursion — capping inlining at MaxRecursiveInlineLevel and leaving the deep tail as virtual Function1.apply. Distinct per-level methods sidestep that cap with no JVM flag, the same way Monocle's per-compose anonymous classes do.
Attributes
- Source
- Getter.scala
Read-only outer ∘ ANY inner — a Getter only reads, so the inner's write side is irrelevant and the composite is the read-only join via compose.ReadCompose (Getter when the inner reads totally, PickFold when partially, ForgetFold when it has many foci). This member covers the writable inners (getter ∘ lens / prism / optional / traversal) that the trait's read-only-inner overload cannot reach; the fused andThen(Getter) / andThen(PickFold) members above stay as the more-specific fast paths.
Read-only outer ∘ ANY inner — a Getter only reads, so the inner's write side is irrelevant and the composite is the read-only join via compose.ReadCompose (Getter when the inner reads totally, PickFold when partially, ForgetFold when it has many foci). This member covers the writable inners (getter ∘ lens / prism / optional / traversal) that the trait's read-only-inner overload cannot reach; the fused andThen(Getter) / andThen(PickFold) members above stay as the more-specific fast paths.
Attributes
- Source
- Getter.scala
Override of the trait's read-only-inner overload, re-homed in this class so it shares an owner with andThenReadAny above — otherwise a read-only inner is ambiguous between the two (the trait one wins on signature specificity, the class one on owner derivation, and dotty calls the split a tie). Same ReadCompose route either way.
Override of the trait's read-only-inner overload, re-homed in this class so it shares an owner with andThenReadAny above — otherwise a read-only inner is ambiguous between the two (the trait one wins on signature specificity, the class one on owner derivation, and dotty calls the split a tie). Same ReadCompose route either way.
Attributes
- Definition Classes
- Source
- Getter.scala
Close the carrier: given a modified focus B (and the leftover X already inside the F), reassemble the result T.
Close the carrier: given a modified focus B (and the leftover X already inside the F), reassemble the result T.
Attributes
- Source
- Getter.scala
Attributes
- Source
- Getter.scala
Push the source S into the carrier, extracting the focus A and packing the leftover X. Paired with from to reconstruct T.
Push the source S into the carrier, extracting the focus A and packing the leftover X. Paired with from to reconstruct T.
Attributes
- Source
- Getter.scala
Inherited methods
Compose with another optic under the shared carrier F. Requires AssociativeFunctor[F]. Cross-carrier composition (Lens → Optional, Lens → Traversal, …) goes through the Morph-summoning overload of this same method.
Compose with another optic under the shared carrier F. Requires AssociativeFunctor[F]. Cross-carrier composition (Lens → Optional, Lens → Traversal, …) goes through the Morph-summoning overload of this same method.
Attributes
- Example
-
case class Address(street: String) case class Person(address: Address) val streetLens = lens[Person](_.address).andThen(lens[Address](_.street)) - Inherited from:
- Optic
- Source
- Optic.scala
Attributes
- Inherited from:
- CanFold
- Source
- CanFold.scala
Attributes
- Inherited from:
- CanFold
- Source
- CanFold.scala
Attributes
- Inherited from:
- CanFold
- Source
- CanFold.scala
Attributes
- Inherited from:
- CanFold
- Source
- CanFold.scala