Class Tuple4<_1,_2,_3,_4>
java.lang.Object
com.jnape.palatable.lambda.adt.hlist.HList
com.jnape.palatable.lambda.adt.hlist.HList.HCons<_1, Tuple3<_2,_3,_4>>
com.jnape.palatable.lambda.adt.hlist.Tuple4<_1,_2,_3,_4>
- Type Parameters:
_1- The first slot element type_2- The second slot element type_3- The third slot element type_4- The fourth slot element type
- All Implemented Interfaces:
Product2<_1,_2>, Product3<_1, _2, _3>, Product4<_1, _2, _3, _4>, Applicative<_4, Tuple4<_1, _2, _3, ?>>, Bifunctor<_3, _4, Tuple4<_1, _2, ?, ?>>, BoundedBifunctor<_3, _4, Object, Object, Tuple4<_1, _2, ?, ?>>, Functor<_4, Tuple4<_1, _2, _3, ?>>, Monad<_4, Tuple4<_1, _2, _3, ?>>, MonadRec<_4, Tuple4<_1, _2, _3, ?>>, Traversable<_4, Tuple4<_1, _2, _3, ?>>, Map.Entry<_1, _2>
public class Tuple4<_1,_2,_3,_4>
extends HList.HCons<_1, Tuple3<_2,_3,_4>>
implements Product4<_1,_2,_3,_4>, MonadRec<_4, Tuple4<_1,_2,_3,?>>, Bifunctor<_3, _4, Tuple4<_1,_2,?,?>>, Traversable<_4, Tuple4<_1,_2,_3,?>>
A 4-element tuple product type, implemented as a specialized HList. Supports random access.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class HList
HList.HCons<Head,Tail>, HList.HNil -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_1()Retrieve the first element._2()Retrieve the second element._3()Retrieve the third element._4()Retrieve the fourth element.Dually map covariantly over both the left and right parameters.Covariantly map over the left parameter.Covariantly map over the right parameter.cons(_0 _0) Cons an element onto the front of this HList.Sequence both thisApplicativeandappB, discarding thisApplicative'sresult and returningappB.Sequence both thisApplicativeandappB, discardingappB'sresult and returning thisApplicative.static <A> Tuple4<A, A, A, A> fill(A a) Given a value of typeA, produced an instance of this tuple with each slot set to that value.Chain dependent computations that may continue or short-circuit based on previous results.Covariantly transmute this functor's parameter using the given mapping function.fromIterable(Iterable<A> as) init()invert()Rotate the first two slots of this product.lazyZip(Lazy<? extends Applicative<Fn1<? super _4, ? extends _4Prime>, Tuple4<_1, _2, _3, ?>>> lazyAppFn) Given alazyinstance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.pure(_4Prime _4Prime) Lift the valuebinto this applicative functor.pureTuple(_1 _1, _2 _2, _3 _3) rotateL3()Rotate the first three values of this product one slot to the left.rotateL4()Rotate the first four values of this product one slot to the left.rotateR3()Rotate the first three values of this product one slot to the right.rotateR4()Rotate the first four values of this product one slot to the right.snoc(_5 _5) Snoc an element onto the back of thisTuple4.trampolineM(Fn1<? super _4, ? extends MonadRec<RecursiveResult<_4, _4Prime>, Tuple4<_1, _2, _3, ?>>> fn) Given some operation yielding aRecursiveResultinside thisMonadRec, internally trampoline the operation until it yields aterminationinstruction.<_4Prime, App extends Applicative<?,App>, TravB extends Traversable<_4Prime, Tuple4<_1, _2, _3, ?>>, AppTrav extends Applicative<TravB, App>>
AppTravtraverse(Fn1<? super _4, ? extends Applicative<_4Prime, 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 HList.HCons
equals, hashCode, head, tail
-
Field Details
-
_1
-
_2
-
_3
-
_4
-
-
Constructor Details
-
Tuple4
-
-
Method Details
-
cons
-
snoc
-
_1
-
_2
-
_3
-
_4
-
rotateL4
-
rotateR4
-
rotateL3
-
rotateR3
-
invert
-
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<_1,_2> - Specified by:
fmapin interfaceFunctor<_1,_2> - Specified by:
fmapin interfaceMonad<_1,_2> - Specified by:
fmapin interfaceMonadRec<_1,_2> - Specified by:
fmapin interfaceTraversable<_1,_2> - Type Parameters:
_4Prime- 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.- Specified by:
biMapLin interfaceBifunctor<_1,_2, _3> - Specified by:
biMapLin interfaceBoundedBifunctor<_3, _4, Object, Object, Tuple4<_1,_2, ?, ?>> - Type Parameters:
_3Prime- the new left parameter type- Parameters:
fn- the mapping function- Returns:
- a bifunctor over C (the new left parameter) and B (the same right parameter)
-
biMapR
Covariantly map over the right parameter. For all bifunctors that are also functors, it should hold thatbiMapR(f) == fmap(f).- Specified by:
biMapRin interfaceBifunctor<_1,_2, _3> - Specified by:
biMapRin interfaceBoundedBifunctor<_3, _4, Object, Object, Tuple4<_1,_2, ?, ?>> - Type Parameters:
_4Prime- the new right parameter type- Parameters:
fn- the mapping function- Returns:
- a bifunctor over A (the same left parameter) and C (the new right parameter)
-
biMap
public <_3Prime,_4Prime> Tuple4<_1,_2, biMap_3Prime, _4Prime> (Fn1<? super _3, ? extends _3Prime> lFn, Fn1<? super _4, ? extends _4Prime> rFn) Dually map covariantly over both the left and right parameters. This is isomorphic tobiMapL(lFn).biMapR(rFn).- Specified by:
biMapin interfaceBifunctor<_1,_2, _3> - Specified by:
biMapin interfaceBoundedBifunctor<_3, _4, Object, Object, Tuple4<_1,_2, ?, ?>> - Type Parameters:
_3Prime- the new left parameter type_4Prime- 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
-
lazyZip
public <_4Prime> Lazy<Tuple4<_1,_2, lazyZip_3, _4Prime>> (Lazy<? extends Applicative<Fn1<? super _4, ? extends _4Prime>, Tuple4<_1, _2, _3, ?>>> 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<_1,_2> - Specified by:
lazyZipin interfaceMonad<_1,_2> - Specified by:
lazyZipin interfaceMonadRec<_1,_2> - Type Parameters:
_4Prime- 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
-
trampolineM
public <_4Prime> Tuple4<_1,_2, trampolineM_3, _4Prime> (Fn1<? super _4, ? extends MonadRec<RecursiveResult<_4, _4Prime>, Tuple4<_1, _2, _3, ?>>> 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<_1,_2> - Type Parameters:
_4Prime- the ultimate resulting carrier type- Parameters:
fn- the function to internally trampoline- Returns:
- the trampolined
MonadRec - See Also:
-
traverse
public <_4Prime, App extends Applicative<?,App>, TravB extends Traversable<_4Prime, Tuple4<_1, AppTrav traverse_2, _3, ?>>, AppTrav extends Applicative<TravB, App>> (Fn1<? super _4, ? extends Applicative<_4Prime, 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<_1,_2> - Type Parameters:
_4Prime- 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
-
init
-
fill
Given a value of typeA, produced an instance of this tuple with each slot set to that value.- Type Parameters:
A- the value type- Parameters:
a- the value to fill the tuple with- Returns:
- the filled tuple
- See Also:
-
fromIterable
-
pureTuple
- Type Parameters:
_1- the head element type_2- the second element type_3- the third element type- Parameters:
_1- the head element_2- the second element_3- the third element- Returns:
- the
Pureinstance
-