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