Class Tuple6<_1,_2,_3,_4,_5,_6>

java.lang.Object
com.jnape.palatable.lambda.adt.hlist.HList
com.jnape.palatable.lambda.adt.hlist.HList.HCons<_1,Tuple5<_2,_3,_4,_5,_6>>
com.jnape.palatable.lambda.adt.hlist.Tuple6<_1,_2,_3,_4,_5,_6>
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
_5 - The fifth slot element type
_6 - The sixth slot element type
All Implemented Interfaces:
Product2<_1,_2>, Product3<_1,_2,_3>, Product4<_1,_2,_3,_4>, Product5<_1,_2,_3,_4,_5>, Product6<_1,_2,_3,_4,_5,_6>, Applicative<_6,Tuple6<_1,_2,_3,_4,_5,?>>, Bifunctor<_5,_6,Tuple6<_1,_2,_3,_4,?,?>>, BoundedBifunctor<_5,_6,Object,Object,Tuple6<_1,_2,_3,_4,?,?>>, Functor<_6,Tuple6<_1,_2,_3,_4,_5,?>>, Monad<_6,Tuple6<_1,_2,_3,_4,_5,?>>, MonadRec<_6,Tuple6<_1,_2,_3,_4,_5,?>>, Traversable<_6,Tuple6<_1,_2,_3,_4,_5,?>>, Map.Entry<_1,_2>

public class Tuple6<_1,_2,_3,_4,_5,_6> extends HList.HCons<_1,Tuple5<_2,_3,_4,_5,_6>> implements Product6<_1,_2,_3,_4,_5,_6>, MonadRec<_6,Tuple6<_1,_2,_3,_4,_5,?>>, Bifunctor<_5,_6,Tuple6<_1,_2,_3,_4,?,?>>, Traversable<_6,Tuple6<_1,_2,_3,_4,_5,?>>
A 6-element tuple product type, implemented as a specialized HList. Supports random access.
See Also:
  • Field Details

    • _1

      private final _1 _1
    • _2

      private final _2 _2
    • _3

      private final _3 _3
    • _4

      private final _4 _4
    • _5

      private final _5 _5
    • _6

      private final _6 _6
  • Constructor Details

  • Method Details

    • cons

      public <_0> Tuple7<_0,_1,_2,_3,_4,_5,_6> cons(_0 _0)
      Cons an element onto the front of this HList.
      Overrides:
      cons in class HList.HCons<_1,Tuple5<_2,_3,_4,_5,_6>>
      Type Parameters:
      _0 - the new head type
      Parameters:
      _0 - the new head element
      Returns:
      the updated HList
    • snoc

      public <_7> Tuple7<_1,_2,_3,_4,_5,_6,_7> snoc(_7 _7)
      Snoc an element onto the back of this Tuple6.
      Type Parameters:
      _7 - the new last element type
      Parameters:
      _7 - the new last element
      Returns:
      the new Tuple7
    • _1

      public _1 _1()
      Retrieve the first element.
      Specified by:
      _1 in interface Product2<_1,_2>
      Returns:
      the first element
    • _2

      public _2 _2()
      Retrieve the second element.
      Specified by:
      _2 in interface Product2<_1,_2>
      Returns:
      the second element
    • _3

      public _3 _3()
      Retrieve the third element.
      Specified by:
      _3 in interface Product3<_1,_2,_3>
      Returns:
      the third element
    • _4

      public _4 _4()
      Retrieve the fourth element.
      Specified by:
      _4 in interface Product4<_1,_2,_3,_4>
      Returns:
      the fourth element
    • _5

      public _5 _5()
      Retrieve the fifth element.
      Specified by:
      _5 in interface Product5<_1,_2,_3,_4,_5>
      Returns:
      the fifth element
    • _6

      public _6 _6()
      Retrieve the sixth element.
      Specified by:
      _6 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the sixth element
    • rotateL6

      public Tuple6<_2,_3,_4,_5,_6,_1> rotateL6()
      Rotate the first six values of this product one slot to the left.
      Specified by:
      rotateL6 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the left-rotated product
    • rotateR6

      public Tuple6<_6,_1,_2,_3,_4,_5> rotateR6()
      Rotate the first six values of this product one slot to the right.
      Specified by:
      rotateR6 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the right-rotated product
    • rotateL5

      public Tuple6<_2,_3,_4,_5,_1,_6> rotateL5()
      Rotate the first five values of this product one slot to the left.
      Specified by:
      rotateL5 in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      rotateL5 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the left-rotated product
    • rotateR5

      public Tuple6<_5,_1,_2,_3,_4,_6> rotateR5()
      Rotate the first five values of this product one slot to the right.
      Specified by:
      rotateR5 in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      rotateR5 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the right-rotated product
    • rotateL4

      public Tuple6<_2,_3,_4,_1,_5,_6> rotateL4()
      Rotate the first four values of this product one slot to the left.
      Specified by:
      rotateL4 in interface Product4<_1,_2,_3,_4>
      Specified by:
      rotateL4 in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      rotateL4 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the left-rotated product
    • rotateR4

      public Tuple6<_4,_1,_2,_3,_5,_6> rotateR4()
      Rotate the first four values of this product one slot to the right.
      Specified by:
      rotateR4 in interface Product4<_1,_2,_3,_4>
      Specified by:
      rotateR4 in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      rotateR4 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the right-rotated product
    • rotateL3

      public Tuple6<_2,_3,_1,_4,_5,_6> rotateL3()
      Rotate the first three values of this product one slot to the left.
      Specified by:
      rotateL3 in interface Product3<_1,_2,_3>
      Specified by:
      rotateL3 in interface Product4<_1,_2,_3,_4>
      Specified by:
      rotateL3 in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      rotateL3 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the left-rotated product
    • rotateR3

      public Tuple6<_3,_1,_2,_4,_5,_6> rotateR3()
      Rotate the first three values of this product one slot to the right.
      Specified by:
      rotateR3 in interface Product3<_1,_2,_3>
      Specified by:
      rotateR3 in interface Product4<_1,_2,_3,_4>
      Specified by:
      rotateR3 in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      rotateR3 in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the right-rotated product
    • invert

      public Tuple6<_2,_1,_3,_4,_5,_6> invert()
      Rotate the first two slots of this product.
      Specified by:
      invert in interface Product2<_1,_2>
      Specified by:
      invert in interface Product3<_1,_2,_3>
      Specified by:
      invert in interface Product4<_1,_2,_3,_4>
      Specified by:
      invert in interface Product5<_1,_2,_3,_4,_5>
      Specified by:
      invert in interface Product6<_1,_2,_3,_4,_5,_6>
      Returns:
      the rotated product
    • fmap

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> fmap(Fn1<? super _6,? extends _6Prime> 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 interface Applicative<_1,_2>
      Specified by:
      fmap in interface Functor<_1,_2>
      Specified by:
      fmap in interface Monad<_1,_2>
      Specified by:
      fmap in interface MonadRec<_1,_2>
      Specified by:
      fmap in interface Traversable<_1,_2>
      Type Parameters:
      _6Prime - the new parameter type
      Parameters:
      fn - the mapping function
      Returns:
      a functor over B (the new parameter type)
    • biMapL

      public <_5Prime> Tuple6<_1,_2,_3,_4,_5Prime,_6> biMapL(Fn1<? super _5,? extends _5Prime> fn)
      Covariantly map over the left parameter.
      Specified by:
      biMapL in interface Bifunctor<_1,_2,_3>
      Specified by:
      biMapL in interface BoundedBifunctor<_1,_2,_3,_4,_5>
      Type Parameters:
      _5Prime - 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

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> biMapR(Fn1<? super _6,? extends _6Prime> fn)
      Covariantly map over the right parameter. For all bifunctors that are also functors, it should hold that biMapR(f) == fmap(f).
      Specified by:
      biMapR in interface Bifunctor<_1,_2,_3>
      Specified by:
      biMapR in interface BoundedBifunctor<_1,_2,_3,_4,_5>
      Type Parameters:
      _6Prime - 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 <_5Prime, _6Prime> Tuple6<_1,_2,_3,_4,_5Prime,_6Prime> biMap(Fn1<? super _5,? extends _5Prime> lFn, Fn1<? super _6,? extends _6Prime> rFn)
      Dually map covariantly over both the left and right parameters. This is isomorphic to biMapL(lFn).biMapR(rFn).
      Specified by:
      biMap in interface Bifunctor<_1,_2,_3>
      Specified by:
      biMap in interface BoundedBifunctor<_1,_2,_3,_4,_5>
      Type Parameters:
      _5Prime - the new left parameter type
      _6Prime - the new right parameter type
      Parameters:
      lFn - the left parameter mapping function
      rFn - the right parameter mapping function
      Returns:
      a bifunctor over C (the new left parameter type) and D (the new right parameter type)
    • pure

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> pure(_6Prime _6Prime)
      Lift the value b into this applicative functor.
      Specified by:
      pure in interface Applicative<_1,_2>
      Specified by:
      pure in interface Monad<_1,_2>
      Specified by:
      pure in interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the type of the returned applicative's parameter
      Parameters:
      _6Prime - the value
      Returns:
      an instance of this applicative over b
    • zip

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> zip(Applicative<Fn1<? super _6,? extends _6Prime>,Tuple6<_1,_2,_3,_4,_5,?>> appFn)
      Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.
      Specified by:
      zip in interface Applicative<_1,_2>
      Specified by:
      zip in interface Monad<_1,_2>
      Specified by:
      zip in interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the resulting applicative parameter type
      Parameters:
      appFn - the other applicative instance
      Returns:
      the mapped applicative
    • lazyZip

      public <_6Prime> Lazy<Tuple6<_1,_2,_3,_4,_5,_6Prime>> lazyZip(Lazy<? extends Applicative<Fn1<? super _6,? extends _6Prime>,Tuple6<_1,_2,_3,_4,_5,?>>> lazyAppFn)
      Given a lazy 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 interface Applicative<_1,_2>
      Specified by:
      lazyZip in interface Monad<_1,_2>
      Specified by:
      lazyZip in interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the resulting applicative parameter type
      Parameters:
      lazyAppFn - the lazy other applicative instance
      Returns:
      the mapped applicative
      See Also:
    • discardL

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> discardL(Applicative<_6Prime,Tuple6<_1,_2,_3,_4,_5,?>> appB)
      Sequence both this Applicative and appB, discarding this Applicative's result and returning appB. This is generally useful for sequentially performing side-effects.
      Specified by:
      discardL in interface Applicative<_1,_2>
      Specified by:
      discardL in interface Monad<_1,_2>
      Specified by:
      discardL in interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the type of the returned Applicative's parameter
      Parameters:
      appB - the other Applicative
      Returns:
      appB
    • discardR

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6> discardR(Applicative<_6Prime,Tuple6<_1,_2,_3,_4,_5,?>> appB)
      Sequence both this Applicative and appB, discarding appB's result and returning this Applicative. This is generally useful for sequentially performing side-effects.
      Specified by:
      discardR in interface Applicative<_1,_2>
      Specified by:
      discardR in interface Monad<_1,_2>
      Specified by:
      discardR in interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the type of appB's parameter
      Parameters:
      appB - the other Applicative
      Returns:
      this Applicative
    • flatMap

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> flatMap(Fn1<? super _6,? extends Monad<_6Prime,Tuple6<_1,_2,_3,_4,_5,?>>> f)
      Chain dependent computations that may continue or short-circuit based on previous results.
      Specified by:
      flatMap in interface Monad<_1,_2>
      Specified by:
      flatMap in interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the resulting monad parameter type
      Parameters:
      f - the dependent computation over A
      Returns:
      the new monad instance
    • trampolineM

      public <_6Prime> Tuple6<_1,_2,_3,_4,_5,_6Prime> trampolineM(Fn1<? super _6,? extends MonadRec<RecursiveResult<_6,_6Prime>,Tuple6<_1,_2,_3,_4,_5,?>>> fn)
      Given some operation yielding a RecursiveResult inside this MonadRec, internally trampoline the operation until it yields a termination 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 interface MonadRec<_1,_2>
      Type Parameters:
      _6Prime - the ultimate resulting carrier type
      Parameters:
      fn - the function to internally trampoline
      Returns:
      the trampolined MonadRec
      See Also:
    • traverse

      public <_6Prime, App extends Applicative<?, App>, TravB extends Traversable<_6Prime, Tuple6<_1, _2, _3, _4, _5, ?>>, AppTrav extends Applicative<TravB, App>> AppTrav traverse(Fn1<? super _6,? extends Applicative<_6Prime,App>> fn, Fn1<? super TravB,? extends AppTrav> pure)
      Apply fn 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 interface Traversable<_1,_2>
      Type Parameters:
      _6Prime - the resulting element type
      App - the result applicative type
      TravB - this Traversable instance over B
      AppTrav - the full inferred resulting type from the traversal
      Parameters:
      fn - the function to apply
      pure - the applicative pure function
      Returns:
      the traversed Traversable, wrapped inside an applicative
    • init

      public Tuple5<_1,_2,_3,_4,_5> init()
      Returns a Tuple5<_1, _2, _3, _4, _5> of all the elements of this Tuple6<_1, _2, _3, _4, _5, _6> except the last.
      Returns:
      The Tuple5<_1, _2, _3, _4, _5> representing all but the last element
    • fill

      public static <A> Tuple6<A,A,A,A,A,A> fill(A a)
      Given a value of type A, 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

      public static <A> Maybe<Tuple6<A,A,A,A,A,A>> fromIterable(Iterable<A> as)
      Return just the first six elements from the given Iterable, or nothing if there are less than six elements.
      Type Parameters:
      A - the Iterable element type
      Parameters:
      as - the Iterable
      Returns:
      Maybe the first six elements of the given Iterable
    • pureTuple

      public static <_1, _2, _3, _4, _5> Pure<Tuple6<_1,_2,_3,_4,_5,?>> pureTuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5)
      The canonical Pure instance for Tuple6.
      Type Parameters:
      _1 - the head element type
      _2 - the second element type
      _3 - the third element type
      _4 - the fourth element type
      _5 - the fifth element type
      Parameters:
      _1 - the head element
      _2 - the second element
      _3 - the third element
      _4 - the fourth element
      _5 - the fifth element
      Returns:
      the Pure instance