Proof - The Profunctor type this optic evaluates.S - The input object type.T - The output object type.A - The input field type.B - The output field type.public interface Optic<Proof extends K1,S,T,A,B>
An optic can be thought to take some transformation S -> T between object types and another
(unrelated) transformation A -> B between field types, and produces a new transformation between
object types such that the field A in S is transformed into B using the field
function, while the rest of S is transformed using the original function.
The object type is also known as a source, and the field type is also known as a focus. The terms "object" and "field" are used throughout in this documentation in order to draw a parallel to the object-oriented paradigm. Note, however, that an optic need not act on a literal field of a conventional object. Also note that optics need not act on a single field, depending on the profunctor this optic takes its behavior from.
Profunctor,
An Introduction to Optics: Lenses and Prisms| Modifier and Type | Interface and Description |
|---|---|
static class |
Optic.CompositionOptic<Proof extends K1,S,T,A,B,A1,B1>
An optic that represents the composition of two compatible optics.
|
| Modifier and Type | Method and Description |
|---|---|
default <Proof2 extends Proof,A1,B1> |
compose(Optic<? super Proof2,A::A1,B::B1> optic)
Composes this optic with another optic that operates on the field types of this optic.
|
default <Proof2 extends K1,A1,B1> |
composeUnchecked(Optic<?,A::A1,B::B1> optic)
Composes this optic with another optic that operates on the field types of this optic without checking for
type compatibility.
|
<P extends K2> |
eval(? extends Proof<P> proof)
Applies the given
Profunctor to this optic to produce a
function that converts a transformation between the field types into a transformation between the object types. |
default <Proof2 extends K1> |
upCast(Set<TypeToken<? extends K1>> proofBounds,
TypeToken<Proof2> proof)
Refines the profunctor type accepted by this optic to the given type, checking against the given bounds.
|
<P extends K2> (P<A,B>) -> P<S,T> eval(? extends Proof<P> proof)
Profunctor to this optic to produce a
function that converts a transformation between the field types into a transformation between the object types.P - The type associated with the profunctor.proof - The profunctor associated with this optic.default <Proof2 extends Proof,A1,B1> Optic<Proof2,S::A1,T::B1> compose(Optic<? super Proof2,A::A1,B::B1> optic)
Optic.CompositionOptic.Proof2 - The profunctor type class of the given optic.A1 - The subfield input type.B1 - The subfield output type.optic - The subfield optic.Optic.CompositionOpticdefault <Proof2 extends K1,A1,B1> Optic<?,S::A1,T::B1> composeUnchecked(Optic<?,A::A1,B::B1> optic)
Warning: This method is unsound. Care must be taken that the profunctor types for this optic and the given optic actually have a common descendant.
Optic.CompositionOptic.Proof2 - The profunctor common descendant for this and the given optic.A1 - The subfield input type.B1 - The subfield output type.optic - The subfield optic.compose(Optic),
Optic.CompositionOpticdefault <Proof2 extends K1> Optional<Optic<? super Proof2,S::A,T::B>> upCast(Set<TypeToken<? extends K1>> proofBounds, TypeToken<Proof2> proof)
Proof2 - The refined profunctor type.proofBounds - The lower bounds of Proof2.proof - The type tag for the refined profunctor type.