Class Choice8<A,B,C,D,E,F,G,H>
- java.lang.Object
-
- com.jnape.palatable.lambda.adt.choice.Choice8<A,B,C,D,E,F,G,H>
-
- 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 typeG- the seventh possible typeH- the eighth possible type
- All Implemented Interfaces:
CoProduct8<A,B,C,D,E,F,G,H,Choice8<A,B,C,D,E,F,G,H>>,Applicative<H,Choice8<A,B,C,D,E,F,G,?>>,Bifunctor<G,H,Choice8<A,B,C,D,E,F,?,?>>,BoundedBifunctor<G,H,java.lang.Object,java.lang.Object,Choice8<A,B,C,D,E,F,?,?>>,Functor<H,Choice8<A,B,C,D,E,F,G,?>>,Monad<H,Choice8<A,B,C,D,E,F,G,?>>,MonadRec<H,Choice8<A,B,C,D,E,F,G,?>>,Traversable<H,Choice8<A,B,C,D,E,F,G,?>>
- Direct Known Subclasses:
Choice8._A,Choice8._B,Choice8._C,Choice8._D,Choice8._E,Choice8._F,Choice8._G,Choice8._H
public abstract class Choice8<A,B,C,D,E,F,G,H> extends java.lang.Object implements CoProduct8<A,B,C,D,E,F,G,H,Choice8<A,B,C,D,E,F,G,H>>, MonadRec<H,Choice8<A,B,C,D,E,F,G,?>>, Bifunctor<G,H,Choice8<A,B,C,D,E,F,?,?>>, Traversable<H,Choice8<A,B,C,D,E,F,G,?>>
Canonical ADT representation ofCoProduct8.- See Also:
Choice7
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classChoice8._A<A,B,C,D,E,F,G,H>private static classChoice8._B<A,B,C,D,E,F,G,H>private static classChoice8._C<A,B,C,D,E,F,G,H>private static classChoice8._D<A,B,C,D,E,F,G,H>private static classChoice8._E<A,B,C,D,E,F,G,H>private static classChoice8._F<A,B,C,D,E,F,G,H>private static classChoice8._G<A,B,C,D,E,F,G,H>private static classChoice8._H<A,B,C,D,E,F,G,H>
-
Constructor Summary
Constructors Modifier Constructor Description privateChoice8()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>a(A a)Static factory method for wrapping a value of typeAin aChoice8.static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>b(B b)Static factory method for wrapping a value of typeBin aChoice8.<I,J>
Choice8<A,B,C,D,E,F,I,J>biMap(Fn1<? super G,? extends I> lFn, Fn1<? super H,? extends J> rFn)Dually map covariantly over both the left and right parameters.<I> Choice8<A,B,C,D,E,F,I,H>biMapL(Fn1<? super G,? extends I> fn)Covariantly map over the left parameter.<I> Choice8<A,B,C,D,E,F,G,I>biMapR(Fn1<? super H,? extends I> fn)Covariantly map over the right parameter.static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>c(C c)Static factory method for wrapping a value of typeCin aChoice8.Choice7<A,B,C,D,E,F,G>converge(Fn1<? super H,? extends CoProduct7<A,B,C,D,E,F,G,?>> convergenceFn)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,G,H>
Choice8<A,B,C,D,E,F,G,H>d(D d)Static factory method for wrapping a value of typeDin aChoice8.<I> Choice8<A,B,C,D,E,F,G,I>discardL(Applicative<I,Choice8<A,B,C,D,E,F,G,?>> appB)Sequence both thisApplicativeandappB, discarding thisApplicative'sresult and returningappB.<I> Choice8<A,B,C,D,E,F,G,H>discardR(Applicative<I,Choice8<A,B,C,D,E,F,G,?>> appB)Sequence both thisApplicativeandappB, discardingappB'sresult and returning thisApplicative.static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>e(E e)Static factory method for wrapping a value of typeEin aChoice8.static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>f(F f)Static factory method for wrapping a value of typeFin aChoice8.<I> Choice8<A,B,C,D,E,F,G,I>flatMap(Fn1<? super H,? extends Monad<I,Choice8<A,B,C,D,E,F,G,?>>> fn)Chain dependent computations that may continue or short-circuit based on previous results.<I> Choice8<A,B,C,D,E,F,G,I>fmap(Fn1<? super H,? extends I> fn)Covariantly transmute this functor's parameter using the given mapping function.static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>g(G g)Static factory method for wrapping a value of typeGin aChoice8.static <A,B,C,D,E,F,G,H>
Choice8<A,B,C,D,E,F,G,H>h(H h)Static factory method for wrapping a value of typeHin aChoice8.<I> Lazy<Choice8<A,B,C,D,E,F,G,I>>lazyZip(Lazy<? extends Applicative<Fn1<? super H,? extends I>,Choice8<A,B,C,D,E,F,G,?>>> lazyAppFn)Given alazyinstance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.Tuple8<Maybe<A>,Maybe<B>,Maybe<C>,Maybe<D>,Maybe<E>,Maybe<F>,Maybe<G>,Maybe<H>>project()Specialize this choice's projection to aTuple8.<I> Choice8<A,B,C,D,E,F,G,I>pure(I i)Lift the valuebinto this applicative functor.static <A,B,C,D,E,F,G>
Pure<Choice8<A,B,C,D,E,F,G,?>>pureChoice()<I> Choice8<A,B,C,D,E,F,G,I>trampolineM(Fn1<? super H,? extends MonadRec<RecursiveResult<H,I>,Choice8<A,B,C,D,E,F,G,?>>> fn)Given some operation yielding aRecursiveResultinside thisMonadRec, internally trampoline the operation until it yields aterminationinstruction.<I,App extends Applicative<?,App>,TravB extends Traversable<I,Choice8<A,B,C,D,E,F,G,?>>,AppTrav extends Applicative<TravB,App>>
AppTravtraverse(Fn1<? super H,? extends Applicative<I,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.<I> Choice8<A,B,C,D,E,F,G,I>zip(Applicative<Fn1<? super H,? extends I>,Choice8<A,B,C,D,E,F,G,?>> appFn)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
-
-
-
-
Method Detail
-
project
public Tuple8<Maybe<A>,Maybe<B>,Maybe<C>,Maybe<D>,Maybe<E>,Maybe<F>,Maybe<G>,Maybe<H>> project()
Specialize this choice's projection to aTuple8.
-
converge
public Choice7<A,B,C,D,E,F,G> converge(Fn1<? super H,? extends CoProduct7<A,B,C,D,E,F,G,?>> convergenceFn)
Converge this coproduct down to a lower order coproduct by mapping the last possible type into an earlier possible type.
-
fmap
public <I> Choice8<A,B,C,D,E,F,G,I> fmap(Fn1<? super H,? extends I> fn)
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:
I- the new parameter type- Parameters:
fn- the mapping function- Returns:
- a functor over B (the new parameter type)
-
biMapL
public <I> Choice8<A,B,C,D,E,F,I,H> biMapL(Fn1<? super G,? extends I> fn)
Covariantly map over the left parameter.
-
biMapR
public <I> Choice8<A,B,C,D,E,F,G,I> biMapR(Fn1<? super H,? extends I> fn)
Covariantly map over the right parameter. For all bifunctors that are also functors, it should hold thatbiMapR(f) == fmap(f).
-
biMap
public <I,J> Choice8<A,B,C,D,E,F,I,J> biMap(Fn1<? super G,? extends I> lFn, Fn1<? super H,? extends J> 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:
I- the new left parameter typeJ- 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
public <I> Choice8<A,B,C,D,E,F,G,I> pure(I i)
Lift the valuebinto this applicative functor.
-
zip
public <I> Choice8<A,B,C,D,E,F,G,I> zip(Applicative<Fn1<? super H,? extends I>,Choice8<A,B,C,D,E,F,G,?>> 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 <I> Lazy<Choice8<A,B,C,D,E,F,G,I>> lazyZip(Lazy<? extends Applicative<Fn1<? super H,? extends I>,Choice8<A,B,C,D,E,F,G,?>>> 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:
I- the resulting applicative parameter type- Parameters:
lazyAppFn- the lazy other applicative instance- Returns:
- the mapped applicative
- See Also:
Maybe,Either
-
discardL
public <I> Choice8<A,B,C,D,E,F,G,I> discardL(Applicative<I,Choice8<A,B,C,D,E,F,G,?>> appB)
Sequence both thisApplicativeandappB, discarding thisApplicative'sresult and returningappB. This is generally useful for sequentially performing side-effects.
-
discardR
public <I> Choice8<A,B,C,D,E,F,G,H> discardR(Applicative<I,Choice8<A,B,C,D,E,F,G,?>> appB)
Sequence both thisApplicativeandappB, discardingappB'sresult and returning thisApplicative. This is generally useful for sequentially performing side-effects.
-
flatMap
public <I> Choice8<A,B,C,D,E,F,G,I> flatMap(Fn1<? super H,? extends Monad<I,Choice8<A,B,C,D,E,F,G,?>>> fn)
Chain dependent computations that may continue or short-circuit based on previous results.
-
trampolineM
public <I> Choice8<A,B,C,D,E,F,G,I> trampolineM(Fn1<? super H,? extends MonadRec<RecursiveResult<H,I>,Choice8<A,B,C,D,E,F,G,?>>> 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:
I- the ultimate resulting carrier type- Parameters:
fn- the function to internally trampoline- Returns:
- the trampolined
MonadRec - See Also:
for a basic implementation,for a implementation,for an implementation leveraging an already stack-safe,for a implementation
-
traverse
public <I,App extends Applicative<?,App>,TravB extends Traversable<I,Choice8<A,B,C,D,E,F,G,?>>,AppTrav extends Applicative<TravB,App>> AppTrav traverse(Fn1<? super H,? extends Applicative<I,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:
I- 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
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> a(A a)
Static factory method for wrapping a value of typeAin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
a- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
b
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> b(B b)
Static factory method for wrapping a value of typeBin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
b- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
c
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> c(C c)
Static factory method for wrapping a value of typeCin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
c- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
d
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> d(D d)
Static factory method for wrapping a value of typeDin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
d- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
e
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> e(E e)
Static factory method for wrapping a value of typeEin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
e- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
f
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> f(F f)
Static factory method for wrapping a value of typeFin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
f- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
g
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> g(G g)
Static factory method for wrapping a value of typeGin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
g- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
h
public static <A,B,C,D,E,F,G,H> Choice8<A,B,C,D,E,F,G,H> h(H h)
Static factory method for wrapping a value of typeHin aChoice8.- 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 typeG- the seventh possible typeH- the eighth possible type- Parameters:
h- the value- Returns:
- the wrapped value as a
Choice8<A, B, C, D, E, F, G, H>
-
pureChoice
public static <A,B,C,D,E,F,G> Pure<Choice8<A,B,C,D,E,F,G,?>> pureChoice()
- 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 typeG- the seventh possible type- Returns:
- the
Pureinstance
-
-