Interface Optic<P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, T, A, B>
- Type Parameters:
P- theProfunctorboundF- theFunctorboundS- the left side of the output profunctorT- the right side's functor embedding of the output profunctorA- the left side of the input profunctorB- the right side's functor embedding of the input profunctor
- All Known Subinterfaces:
Iso<S,T, A, B>, Iso.Simple<S, A>, Lens<S, T, A, B>, Lens.Simple<S, A>, Optic.Simple<P, F, S, A>, Prism<S, T, A, B>, Prism.Simple<S, A>, ProtoOptic<P, S, T, A, B>, Schema<Values>, TypeSafeKey<A, B>, TypeSafeKey.Simple<A>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface Optic<P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, T, A, B>
A generic supertype representation for profunctor optics.
Precisely stated, for some Profunctor P and some Functor F, and for the
types S T A B, an
is a polymorphic function
Optic<P, F, S, T, A, B>P<A, F<B>> -> P<S, F<T>>.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceOptic.Simple<P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, A> -
Method Summary
Modifier and TypeMethodDescriptionLeft-to-right composition of optics.<CoP extends Profunctor<?, ?, ? extends P>, CoF extends Functor<?, ? extends F>, FB extends Functor<B, ? extends CoF>, FT extends Functor<T, ? extends CoF>, PAFB extends Profunctor<A, FB, ? extends CoP>, PSFT extends Profunctor<S, FT, ? extends CoP>>
PSFTapply(PAFB pafb) The polymorphic arrow between profunctors in this optic interface.Right-to-Left composition of optics.Covariantly mapAtoC, yielding a new optic.Contravariantly mapBtoZ, yielding a new optic.Contravariantly mapStoR, yielding a new optic.Covariantly mapTtoU, yielding a new optic.default <CoP extends Profunctor<?, ?, ? extends P>, CoF extends Functor<?, ? extends F>, FB extends Functor<B, ? extends CoF>, FT extends Functor<T, ? extends CoF>, PAFB extends Profunctor<A, FB, ? extends CoP>, PSFT extends Profunctor<S, FT, ? extends CoP>>
Fn1<PAFB, PSFT> static <P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, T, A, B, FB extends Functor<B, ? extends F>, FT extends Functor<T, ? extends F>, PAFB extends Profunctor<A, FB, ? extends P>, PSFT extends Profunctor<S, FT, ? extends P>>
Optic<P, F, S, T, A, B> Promote a monomorphic function to a compatibleOptic.static <P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, T, A, B>
Optic<P, F, S, T, A, B> Reframe anOpticaccording to covariant bounds.
-
Method Details
-
apply
<CoP extends Profunctor<?, ?, ? extends P>, CoF extends Functor<?, ? extends F>, FB extends Functor<B, ? extends CoF>, FT extends Functor<T, ? extends CoF>, PAFB extends Profunctor<A, FB, ? extends CoP>, PSFT extends Profunctor<S, FT, ? extends CoP>> PSFT apply(PAFB pafb) The polymorphic arrow between profunctors in this optic interface.- Type Parameters:
CoP- the profunctor type constraint witnessed by the application of this opticCoF- the functor type constraint witnessed by the application of this opticFB- the covariant parameter type of the input profunctorFT- the covariant parameter type of the output profunctorPAFB- the full input typePSFT- the full output type- Parameters:
pafb- the input- Returns:
- the output profunctor
-
monomorphize
default <CoP extends Profunctor<?, ?, ? extends P>, CoF extends Functor<?, ? extends F>, FB extends Functor<B, ? extends CoF>, FT extends Functor<T, ? extends CoF>, PAFB extends Profunctor<A, FB, ? extends CoP>, PSFT extends Profunctor<S, FT, ? extends CoP>> Fn1<PAFB,PSFT> monomorphize() -
andThen
Left-to-right composition of optics. Requires compatibility betweenSandT.- Type Parameters:
Z- the new left side of the input profunctorC- the new right side's functor embedding of the input profunctor- Parameters:
f- the other optic- Returns:
- the composed optic
-
compose
Right-to-Left composition of optics. Requires compatibility betweenAandB.- Type Parameters:
R- the new left side of the output profunctorU- the new right side's functor embedding of the output profunctor- Parameters:
g- the other optic- Returns:
- the composed optic
-
mapS
-
mapT
-
mapA
-
mapB
-
optic
static <P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, T, A, B, FB extends Functor<B, ? extends F>, FT extends Functor<T, ? extends F>, PAFB extends Profunctor<A, FB, ? extends P>, PSFT extends Profunctor<S, FT, ? extends P>> Optic<P,F, opticS, T, A, B> (Fn1<PAFB, PSFT> fn) Promote a monomorphic function to a compatibleOptic.- Type Parameters:
P- theProfunctorboundF- theFunctorboundS- the left side of the output profunctorT- the right side's functor embedding of the output profunctorA- the left side of the input profunctorB- the right side's functor embedding of the input profunctorFB- fixed functor over B for inferenceFT- fixed functor over T for inferencePAFB- the inputPSFT- the output- Parameters:
fn- the function- Returns:
- the
Optic
-
reframe
static <P extends Profunctor<?, ?, ? extends P>, F extends Functor<?, ? extends F>, S, T, A, B> Optic<P,F, reframeS, T, A, B> (Optic<? super P, ? super F, S, T, A, B> optic) Reframe anOpticaccording to covariant bounds.- Type Parameters:
P- theProfunctortypeF- theFunctortypeS- the left side of the output profunctorT- the right side's functor embedding of the output profunctorA- the left side of the input profunctorB- the right side's functor embedding of the input profunctor- Parameters:
optic- theOptic- Returns:
- the covariantly reframed
Optic
-