T - The container type.C - The right type of the either.Mu - The witness type for this functor.public interface CocartesianLike<T extends K1,C,Mu extends CocartesianLike _> extends Functor T, Traversable T
Traversable functor that can convert values to and from a sum type. This type class defines two
methods, from(App) and to(App), that convert the type T from and to the type
Either.Cocartesian| Modifier and Type | Method and Description |
|---|---|
<A> T<A> |
from((A|C) input)
Converts the given
Either to the container type. |
<A> (A|C) |
to(T<A> input)
Converts the given container to an
Either. |
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)
Either.A - The type of the contained values.input - The container.Either representing an equivalent container.<A> T<A> from((A|C) input)
Either to the container type.A - The type of the contained values.input - The Either.default <F extends K1,A,B> F<T<B>> traverse(Applicative F applicative, (A) -> F<B> function, T<A> input)
TraversableApplicative 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 K1F - 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.