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 class
Choice8._A<A,B,C,D,E,F,G,H>
private static class
Choice8._B<A,B,C,D,E,F,G,H>
private static class
Choice8._C<A,B,C,D,E,F,G,H>
private static class
Choice8._D<A,B,C,D,E,F,G,H>
private static class
Choice8._E<A,B,C,D,E,F,G,H>
private static class
Choice8._F<A,B,C,D,E,F,G,H>
private static class
Choice8._G<A,B,C,D,E,F,G,H>
private static class
Choice8._H<A,B,C,D,E,F,G,H>
-
Constructor Summary
Constructors Modifier Constructor Description private
Choice8()
-
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 typeA
in 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 typeB
in 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 typeC
in 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 typeD
in 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 thisApplicative
andappB
, discarding thisApplicative's
result 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 thisApplicative
andappB
, discardingappB's
result 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 typeE
in 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 typeF
in 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 typeG
in 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 typeH
in 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 alazy
instance 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 valueb
into 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 aRecursiveResult
inside thisMonadRec
, internally trampoline the operation until it yields atermination
instruction.<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)
Applyfn
to 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:
fmap
in interfaceApplicative<A,B>
- Specified by:
fmap
in interfaceFunctor<A,B>
- Specified by:
fmap
in interfaceMonad<A,B>
- Specified by:
fmap
in interfaceMonadRec<A,B>
- Specified by:
fmap
in 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:
biMap
in interfaceBifunctor<A,B,C>
- Specified by:
biMap
in 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 valueb
into 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 alazy
instance 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:
lazyZip
in interfaceApplicative<A,B>
- Specified by:
lazyZip
in interfaceMonad<A,B>
- Specified by:
lazyZip
in 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 thisApplicative
andappB
, discarding thisApplicative's
result 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 thisApplicative
andappB
, discardingappB's
result 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 aRecursiveResult
inside thisMonadRec
, internally trampoline the operation until it yields atermination
instruction.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:
trampolineM
in 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)
Applyfn
to 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:
traverse
in 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 typeA
in 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 typeB
in 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 typeC
in 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 typeD
in 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 typeE
in 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 typeF
in 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 typeG
in 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 typeH
in 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
Pure
instance
-
-