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 someFunctor
F
, and for the typesS
T
A
B
, an
is a polymorphic functionOptic
<P, F, S, T, A, B>P<A, F<B>> -> P<S, F<T>>
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Optic.Simple<P extends Profunctor<?,?,? extends P>,F extends Functor<?,? extends F>,S,A>
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <Z,C>
Optic<P,F,S,T,Z,C>andThen(Optic<? super P,? super F,A,B,Z,C> f)
Left-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.default <R,U>
Optic<P,F,R,U,A,B>compose(Optic<? super P,? super F,R,U,S,T> g)
Right-to-Left composition of optics.default <C> Optic<P,F,S,T,C,B>
mapA(Fn1<? super A,? extends C> fn)
Covariantly mapA
toC
, yielding a new optic.default <Z> Optic<P,F,S,T,A,Z>
mapB(Fn1<? super Z,? extends B> fn)
Contravariantly mapB
toZ
, yielding a new optic.default <R> Optic<P,F,R,T,A,B>
mapS(Fn1<? super R,? extends S> fn)
Contravariantly mapS
toR
, yielding a new optic.default <U> Optic<P,F,S,U,A,B>
mapT(Fn1<? super T,? extends U> fn)
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>monomorphize()
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>optic(Fn1<PAFB,PSFT> fn)
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(Optic<? super P,? super F,S,T,A,B> optic)
Reframe anOptic
according to covariant bounds.
-
-
-
Method Detail
-
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
default <Z,C> Optic<P,F,S,T,Z,C> andThen(Optic<? super P,? super F,A,B,Z,C> f)
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
default <R,U> Optic<P,F,R,U,A,B> compose(Optic<? super P,? super F,R,U,S,T> g)
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
default <R> Optic<P,F,R,T,A,B> mapS(Fn1<? super R,? extends S> fn)
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
default <U> Optic<P,F,S,U,A,B> mapT(Fn1<? super T,? extends U> fn)
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
default <C> Optic<P,F,S,T,C,B> mapA(Fn1<? super A,? extends C> fn)
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
default <Z> Optic<P,F,S,T,A,Z> mapB(Fn1<? super Z,? extends B> fn)
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<?,?,? 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> optic(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<?,?,? extends P>,F extends Functor<?,? extends F>,S,T,A,B> Optic<P,F,S,T,A,B> reframe(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
-
-