A2
- The input field type.B2
- The output field type.public static final class Traversal.Instance<A2,B2> extends Object implements TraversalP Traversal<_::A2,_::B2>
TraversalP
type class instance for Traversal
.Constructor and Description |
---|
Instance() |
Modifier and Type | Method and Description |
---|---|
<A,B,C,D> (Traversal<A::A2,B::B2>) -> Traversal<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 . |
<S,T,A,B> Traversal<S::A2,T::B2> |
wander(Wander<S::A,T::B> wander,
Traversal<A::A2,B::B2> input)
Takes an operation defined by
Wander and a transformation between field types, and produces a
transformation between object types. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
first, left, toFP3, traverse
right, toFP
dimap, dimap, lmap, rmap
public <A,B,C,D> (Traversal<A::A2,B::B2>) -> Traversal<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 Traversal<_::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 <S,T,A,B> Traversal<S::A2,T::B2> wander(Wander<S::A,T::B> wander, Traversal<A::A2,B::B2> input)
TraversalP
Wander
and a transformation between field types, and produces a
transformation between object types.
The returned transformation should accept an object S
, extract a field A
, apply the given input,
and return the resulting B
via an output object T
, all in the context of some effectful computation
defined by the wander
.
wander
in interface TraversalP Traversal<_::A2,_::B2>
S
- The input object type.T
- The output object type.A
- The input field type.B
- The output field type.wander
- A mapping from effectful functions on the field types to effectful functions on the object types.input
- A (non-effectful) transformation between object types.Wander
,
Traversable