P
- The type of transformation.Mu
- The witness type for this profunctor.public interface TraversalP<P extends K2,Mu extends TraversalP _> extends AffineP P
Profunctor
type class for Traversal
optics. This type extends
AffineP
with the method wander(Wander, App2)
, which applies a given Wander
transformation
to the input.Modifier and Type | Method and Description |
---|---|
default <A,B,C> P<(A,C),(B,C)> |
first(P<A,B> input)
Converts the given transformation into one that transforms the first type of a
Pair . |
default <A,B,C> P<(A|C),(B|C)> |
left(P<A,B> input)
Converts the given transformation into one that transforms the left type of an
Either . |
default FunctorProfunctor<Traversable _> P |
toFP3()
Converts this profunctor into a
FunctorProfunctor that distributes Traversable functors. |
default <T extends K1,A,B> |
traverse(Traversable T traversable,
P<A,B> input)
Takes a
Traversable instance and some input transformation, and produces an output transformation
between the effects defined by the traversable instance. |
<S,T,A,B> P<S,T> |
wander(Wander<S::A,T::B> wander,
P<A,B> input)
Takes an operation defined by
Wander and a transformation between field types, and produces a
transformation between object types. |
right, toFP
<S,T,A,B> P<S,T> wander(Wander<S::A,T::B> wander, P<A,B> input)
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
.
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
default <T extends K1,A,B> P<T<A>,T<B>> traverse(Traversable T traversable, P<A,B> input)
Traversable
instance and some input transformation, and produces an output transformation
between the effects defined by the traversable instance.
This is a specialization of wander(Wander, App2)
where S' = T<A>
and T' = T<B>
.
wander(Wander, App2)
with a Wander
value that uses
the given Traversable
to traverse inputs.T
- The traversable type.A
- The input field type.B
- The output field type.traversable
- A Traversable
instance for T
.input
- A transformation between field types.default <A,B,C> P<(A,C),(B,C)> first(P<A,B> input)
Cartesian
Pair
. The second type
is not transformed - any values of that type are passed through the returned transformation unchanged.default <A,B,C> P<(A|C),(B|C)> left(P<A,B> input)
Cocartesian
Either
. The right
type of the Either
is left unchanged by the returned transformation.left
in interface Cocartesian P extends K2
A
- The input type.B
- The output type.C
- A "pass-through" type that is not transformed.input
- The transformation.Either
.default FunctorProfunctor<Traversable _> P toFP3()
FunctorProfunctor
that distributes Traversable
functors.