Class Choice6<A,B,C,D,E,F>
java.lang.Object
com.jnape.palatable.lambda.adt.choice.Choice6<A,B,C,D,E,F>
- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type
- All Implemented Interfaces:
CoProduct6<A,,B, C, D, E, F, Choice6<A, B, C, D, E, F>> Applicative<F,,Choice6<A, B, C, D, E, ?>> Bifunctor<E,,F, Choice6<A, B, C, D, ?, ?>> BoundedBifunctor<E,,F, Object, Object, Choice6<A, B, C, D, ?, ?>> Functor<F,,Choice6<A, B, C, D, E, ?>> Monad<F,,Choice6<A, B, C, D, E, ?>> MonadRec<F,,Choice6<A, B, C, D, E, ?>> Traversable<F,Choice6<A, B, C, D, E, ?>>
- Direct Known Subclasses:
Choice6._A,Choice6._B,Choice6._C,Choice6._D,Choice6._E,Choice6._F
public abstract class Choice6<A,B,C,D,E,F>
extends Object
implements CoProduct6<A,B,C,D,E,F,Choice6<A,B,C,D,E,F>>, MonadRec<F,Choice6<A,B,C,D,E,?>>, Bifunctor<E,F,Choice6<A,B,C,D,?,?>>, Traversable<F,Choice6<A,B,C,D,E,?>>
Canonical ADT representation of
CoProduct6.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final classprivate static final classprivate static final classprivate static final classprivate static final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A,B, C, D, E, F>
Choice6<A, B, C, D, E, F> a(A a) Static factory method for wrapping a value of typeAin aChoice6.static <A,B, C, D, E, F>
Choice6<A, B, C, D, E, F> b(B b) Static factory method for wrapping a value of typeBin aChoice6.Dually map covariantly over both the left and right parameters.Covariantly map over the left parameter.Covariantly map over the right parameter.static <A,B, C, D, E, F>
Choice6<A, B, C, D, E, F> c(C c) Static factory method for wrapping a value of typeCin aChoice6.Converge this coproduct down to a lower order coproduct by mapping the last possible type into an earlier possible type.static <A,B, C, D, E, F>
Choice6<A, B, C, D, E, F> d(D d) Static factory method for wrapping a value of typeDin aChoice6.Sequence both thisApplicativeandappB, discarding thisApplicative'sresult and returningappB.Sequence both thisApplicativeandappB, discardingappB'sresult and returning thisApplicative.diverge()Diverge this coproduct by introducing another possible type that it could represent.static <A,B, C, D, E, F>
Choice6<A, B, C, D, E, F> e(E e) Static factory method for wrapping a value of typeEin aChoice6.static <A,B, C, D, E, F>
Choice6<A, B, C, D, E, F> f(F f) Static factory method for wrapping a value of typeFin aChoice6.Chain dependent computations that may continue or short-circuit based on previous results.Covariantly transmute this functor's parameter using the given mapping function.Given alazyinstance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.project()Specialize this choice's projection to aTuple6.pure(G g) Lift the valuebinto this applicative functor.Given some operation yielding aRecursiveResultinside thisMonadRec, internally trampoline the operation until it yields aterminationinstruction.<G,App extends Applicative<?, App>, TravB extends Traversable<G, Choice6<A, B, C, D, E, ?>>, AppTrav extends Applicative<TravB, App>>
AppTravtraverse(Fn1<? super F, ? extends Applicative<G, App>> fn, Fn1<? super TravB, ? extends AppTrav> pure) Applyfnto each element of this traversable from left to right, and collapse the results into a single resulting applicative, potentially with the assistance of the applicative's pure function.Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Choice6
private Choice6()
-
-
Method Details
-
project
Specialize this choice's projection to aTuple6. -
diverge
Diverge this coproduct by introducing another possible type that it could represent. -
converge
Converge this coproduct down to a lower order coproduct by mapping the last possible type into an earlier possible type. -
fmap
Covariantly transmute this functor's parameter using the given mapping function. Generally this method is specialized to return an instance of the class implementing Functor.- Specified by:
fmapin interfaceApplicative<A,B> - Specified by:
fmapin interfaceFunctor<A,B> - Specified by:
fmapin interfaceMonad<A,B> - Specified by:
fmapin interfaceMonadRec<A,B> - Specified by:
fmapin interfaceTraversable<A,B> - Type Parameters:
G- the new parameter type- Parameters:
fn- the mapping function- Returns:
- a functor over B (the new parameter type)
-
biMapL
Covariantly map over the left parameter. -
biMapR
Covariantly map over the right parameter. For all bifunctors that are also functors, it should hold thatbiMapR(f) == fmap(f). -
biMap
public <G,H> Choice6<A,B, biMapC, D, G, H> (Fn1<? super E, ? extends G> lFn, Fn1<? super F, ? extends H> rFn) Dually map covariantly over both the left and right parameters. This is isomorphic tobiMapL(lFn).biMapR(rFn).- Specified by:
biMapin interfaceBifunctor<A,B, C> - Specified by:
biMapin interfaceBoundedBifunctor<A,B, C, D, E> - Type Parameters:
G- the new left parameter typeH- the new right parameter type- Parameters:
lFn- the left parameter mapping functionrFn- the right parameter mapping function- Returns:
- a bifunctor over C (the new left parameter type) and D (the new right parameter type)
-
pure
Lift the valuebinto this applicative functor. -
zip
public <G> Choice6<A,B, zipC, D, E, G> (Applicative<Fn1<? super F, ? extends G>, Choice6<A, B, C, D, E, ?>> appFn) Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports. -
lazyZip
public <G> Lazy<Choice6<A,B, lazyZipC, D, E, G>> (Lazy<? extends Applicative<Fn1<? super F, ? extends G>, Choice6<A, B, C, D, E, ?>>> lazyAppFn) Given alazyinstance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports. This is useful for applicatives that support lazy evaluation and early termination.- Specified by:
lazyZipin interfaceApplicative<A,B> - Specified by:
lazyZipin interfaceMonad<A,B> - Specified by:
lazyZipin interfaceMonadRec<A,B> - Type Parameters:
G- the resulting applicative parameter type- Parameters:
lazyAppFn- the lazy other applicative instance- Returns:
- the mapped applicative
- See Also:
-
discardL
Sequence both thisApplicativeandappB, discarding thisApplicative'sresult and returningappB. This is generally useful for sequentially performing side-effects. -
discardR
Sequence both thisApplicativeandappB, discardingappB'sresult and returning thisApplicative. This is generally useful for sequentially performing side-effects. -
flatMap
Chain dependent computations that may continue or short-circuit based on previous results. -
trampolineM
public <G> Choice6<A,B, trampolineMC, D, E, G> (Fn1<? super F, ? extends MonadRec<RecursiveResult<F, G>, Choice6<A, B, C, D, E, ?>>> fn) Given some operation yielding aRecursiveResultinside thisMonadRec, internally trampoline the operation until it yields aterminationinstruction.Stack-safety depends on implementations guaranteeing that the growth of the call stack is a constant factor independent of the number of invocations of the operation. For various examples of how this can be achieved in stereotypical circumstances, see the referenced types.
- Specified by:
trampolineMin interfaceMonadRec<A,B> - Type Parameters:
G- the ultimate resulting carrier type- Parameters:
fn- the function to internally trampoline- Returns:
- the trampolined
MonadRec - See Also:
-
traverse
public <G,App extends Applicative<?, AppTrav traverseApp>, TravB extends Traversable<G, Choice6<A, B, C, D, E, ?>>, AppTrav extends Applicative<TravB, App>> (Fn1<? super F, ? extends Applicative<G, App>> fn, Fn1<? super TravB, ? extends AppTrav> pure) Applyfnto each element of this traversable from left to right, and collapse the results into a single resulting applicative, potentially with the assistance of the applicative's pure function.- Specified by:
traversein interfaceTraversable<A,B> - Type Parameters:
G- the resulting element typeApp- the result applicative typeTravB- this Traversable instance over BAppTrav- the full inferred resulting type from the traversal- Parameters:
fn- the function to applypure- the applicative pure function- Returns:
- the traversed Traversable, wrapped inside an applicative
-
a
Static factory method for wrapping a value of typeAin aChoice6.- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type- Parameters:
a- the value- Returns:
- the wrapped value as a
Choice6<A, B, C, D, E, F>
-
b
Static factory method for wrapping a value of typeBin aChoice6.- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type- Parameters:
b- the value- Returns:
- the wrapped value as a
Choice6<A, B, C, D, E, F>
-
c
Static factory method for wrapping a value of typeCin aChoice6.- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type- Parameters:
c- the value- Returns:
- the wrapped value as a
Choice6<A, B, C, D, E, F>
-
d
Static factory method for wrapping a value of typeDin aChoice6.- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type- Parameters:
d- the value- Returns:
- the wrapped value as a
Choice6<A, B, C, D, E, F>
-
e
Static factory method for wrapping a value of typeEin aChoice6.- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type- Parameters:
e- the value- Returns:
- the wrapped value as a
Choice6<A, B, C, D, E, F>
-
f
Static factory method for wrapping a value of typeFin aChoice6.- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeF- the sixth possible type- Parameters:
f- the value- Returns:
- the wrapped value as a
Choice6<A, B, C, D, E, F>
-
pureChoice
- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible type- Returns:
- the
Pureinstance
-