T
- The partially applied product type.C
- The other type of interest in the product type.Mu
- The witness type of this functor.public interface CartesianLike<T extends K1,C,Mu extends CartesianLike _> extends Functor T, Traversable T
Traversable
functor that operates on a product type, such as a tuple. This type class defines two
methods, from(App)
and to(App)
, that convert the type T
to and from a Pair
.Cartesian
Modifier and Type | Method and Description |
---|---|
<A> T<A> |
from((A,C) input)
Transforms a pair of
(A, C) into a container of A and C . |
<A> (A,C) |
to(T<A> input)
|
default <F extends K1,A,B> |
traverse(Applicative F applicative,
(A) -> F<B> function,
T<A> input)
Applies a function that produces an
Applicative effect to each value contained within
input , then builds a container with an equivalent structure containing the (unboxed) results. |
flip
<A> (A,C) to(T<A> input)
A
- The type of the value stored in the container.input
- The input container.<A> T<A> from((A,C) input)
(A, C)
into a container of A
and C
.A
- The type of value stored in the pair.input
- The input pair.default <F extends K1,A,B> F<T<B>> traverse(Applicative F applicative, (A) -> F<B> function, T<A> input)
Traversable
Applicative
effect to each value contained within
input
, then builds a container with an equivalent structure containing the (unboxed) results.traverse
in interface Traversable T extends K1
F
- The type of the effect.A
- The input type.B
- The output type.applicative
- An instance of the Applicative
type class which defines the behavior of F
.function
- The function to apply.input
- The input container.function
to each element, if the function was
successful for every element.