A2
- The input field type.B2
- The output field type.public static final class Lens.Instance<A2,B2> extends Object implements Cartesian Lens<_::A2,_::B2>
Cartesian
type class instance for Lens
. This type class corresponds to the partially applied
Lens.Mu
.Constructor and Description |
---|
Instance() |
Modifier and Type | Method and Description |
---|---|
<A,B,C,D> (Lens<A::A2,B::B2>) -> Lens<C::A2,D::B2> |
dimap((C) -> A g,
(B) -> D h)
Takes a function from the output type
C to the input type A and a function from the input
type B to the output type D , and returns a function from a container of A, B to
a container of C, D . |
<A,B,C> Lens<(A,C)::A2,(B,C)::B2> |
first(Lens<A::A2,B::B2> input)
Converts the given transformation into one that transforms the first type of a
Pair . |
<A,B,C> Lens<(C,A)::A2,(C,B)::B2> |
second(Lens<A::A2,B::B2> input)
Converts the given transformation into one that transforms the second type of a
Pair . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dimap, dimap, lmap, rmap
public <A,B,C,D> (Lens<A::A2,B::B2>) -> Lens<C::A2,D::B2> dimap((C) -> A g, (B) -> D h)
Profunctor
C
to the input type A
and a function from the input
type B
to the output type D
, and returns a function from a container of A, B
to
a container of C, D
.
A straightforward example of an implementation of dimap
is the method Function.andThen(Function)
.
For functions, the expression
dimap(g, h).apply(f)
is equivalent to
g.andThen(f).andThen(h)
dimap
in interface Profunctor Lens<_::A2,_::B2>
A
- The first input type.B
- The second input type.C
- The first output type.D
- The second output type.g
- A function from output to input.h
- A function from input to output.Profunctor.dimap(App2, Function, Function)
public <A,B,C> Lens<(A,C)::A2,(B,C)::B2> first(Lens<A::A2,B::B2> input)
Cartesian
Pair
. The second type
is not transformed - any values of that type are passed through the returned transformation unchanged.first
in interface Cartesian Lens<_::A2,_::B2>
A
- The input type.B
- The output type.C
- A "pass-through" type that is not transformed.input
- The transformation.public <A,B,C> Lens<(C,A)::A2,(C,B)::B2> second(Lens<A::A2,B::B2> input)
Cartesian
Pair
. The first type
is not transformed - any values of that type are passed through the returned transformation unchanged.second
in interface Cartesian Lens<_::A2,_::B2>
A
- The input type.B
- The output type.C
- A "pass-through" type that is not transformed.input
- The transformation.