Interface Optic<P extends Profunctor<?,?,? extends P>,F extends Functor<?,? extends F>,S,T,A,B>
- Type Parameters:
P
- theProfunctor
boundF
- theFunctor
boundS
- 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 interface
Optic.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 mapA
toC
, yielding a new optic.Contravariantly mapB
toZ
, yielding a new optic.Contravariantly mapS
toR
, yielding a new optic.Covariantly mapT
toU
, 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 anOptic
according to covariant bounds.
-
Method Details
-
apply
<CoP extends Profunctor<?,?, PSFT apply? 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>> (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<?,?, Fn1<PAFB,? 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> monomorphize() -
andThen
Left-to-right composition of optics. Requires compatibility betweenS
andT
.- 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 betweenA
andB
.- 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
Contravariantly mapS
toR
, yielding a new optic.- Type Parameters:
R
- the new left side of the output profunctor- Parameters:
fn
- the mapping function- Returns:
- the new optic
-
mapT
Covariantly mapT
toU
, yielding a new optic.- Type Parameters:
U
- the new right side's functor embedding of the output profunctor- Parameters:
fn
- the mapping function- Returns:
- the new optic
-
mapA
Covariantly mapA
toC
, yielding a new optic.- Type Parameters:
C
- the new left side of the input profunctor- Parameters:
fn
- the mapping function- Returns:
- the new optic
-
mapB
Contravariantly mapB
toZ
, yielding a new optic.- Type Parameters:
Z
- the new right side's functor embedding of the input profunctor- Parameters:
fn
- the mapping function- Returns:
- the new optic
-
optic
static <P extends Profunctor<?,?, Optic<P,? 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>> F, opticS, T, A, B> (Fn1<PAFB, PSFT> fn) Promote a monomorphic function to a compatibleOptic
.- Type Parameters:
P
- theProfunctor
boundF
- theFunctor
boundS
- 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<?,?, Optic<P,? extends P>, F extends Functor<?, ? extends F>, S, T, A, B> F, reframeS, T, A, B> (Optic<? super P, ? super F, S, T, A, B> optic) Reframe anOptic
according to covariant bounds.- Type Parameters:
P
- theProfunctor
typeF
- theFunctor
typeS
- 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
-