java.lang.Object
com.jnape.palatable.lambda.adt.hlist.HList
Direct Known Subclasses:
HList.HCons, HList.HNil

public abstract class HList extends Object
An immutable heterogeneous list supporting arbitrary depth type-safety via a linearly recursive type signature. Note that due to its rapidly expanding type signature, specializations exist up to certain depths to minimize typing overhead.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The consing of a head element to a tail HList.
    static final class 
    The empty HList.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <Head, Tail extends HList>
    HList.HCons<Head,Tail>
    cons(Head head, Tail tail)
    Static factory method for creating an HList from the given head and tail.
    abstract <NewHead> HList.HCons<NewHead,? extends HList>
    cons(NewHead newHead)
    Cons an element onto the front of this HList.
    static HList.HNil
    nil()
    Static factory method for creating empty HLists.
    static <Head> SingletonHList<Head>
    singletonHList(Head head)
    Static factory method for creating a singleton HList.
    final String
     
    static <_1, _2> Tuple2<_1,_2>
    tuple(_1 _1, _2 _2)
    Static factory method for creating a 2-element HList.
    static <_1, _2, _3>
    Tuple3<_1,_2,_3>
    tuple(_1 _1, _2 _2, _3 _3)
    Static factory method for creating a 3-element HList.
    static <_1, _2, _3, _4>
    Tuple4<_1,_2,_3,_4>
    tuple(_1 _1, _2 _2, _3 _3, _4 _4)
    Static factory method for creating a 4-element HList.
    static <_1, _2, _3, _4, _5>
    Tuple5<_1,_2,_3,_4,_5>
    tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5)
    Static factory method for creating a 5-element HList.
    static <_1, _2, _3, _4, _5, _6>
    Tuple6<_1,_2,_3,_4,_5,_6>
    tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5, _6 _6)
    Static factory method for creating a 6-element HList.
    static <_1, _2, _3, _4, _5, _6, _7>
    Tuple7<_1,_2,_3,_4,_5,_6,_7>
    tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5, _6 _6, _7 _7)
    Static factory method for creating a 7-element HList.
    static <_1, _2, _3, _4, _5, _6, _7, _8>
    Tuple8<_1,_2,_3,_4,_5,_6,_7,_8>
    tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5, _6 _6, _7 _7, _8 _8)
    Static factory method for creating an 8-element HList.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HList

      private HList()
  • Method Details

    • cons

      public abstract <NewHead> HList.HCons<NewHead,? extends HList> cons(NewHead newHead)
      Cons an element onto the front of this HList.
      Type Parameters:
      NewHead - the new head type
      Parameters:
      newHead - the new head element
      Returns:
      the updated HList
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • nil

      public static HList.HNil nil()
      Static factory method for creating empty HLists.
      Returns:
      an empty HList
    • cons

      public static <Head, Tail extends HList> HList.HCons<Head,Tail> cons(Head head, Tail tail)
      Static factory method for creating an HList from the given head and tail.
      Type Parameters:
      Head - the head type
      Tail - the tail type
      Parameters:
      head - the head element
      tail - the tail HList
      Returns:
      the newly created HList
    • singletonHList

      public static <Head> SingletonHList<Head> singletonHList(Head head)
      Static factory method for creating a singleton HList.
      Type Parameters:
      Head - the head element type
      Parameters:
      head - the head element
      Returns:
      the singleton HList
    • tuple

      public static <_1, _2> Tuple2<_1,_2> tuple(_1 _1, _2 _2)
      Static factory method for creating a 2-element HList.
      Type Parameters:
      _1 - the head element type
      _2 - the second element type
      Parameters:
      _1 - the head element
      _2 - the second element
      Returns:
      the 2-element HList
      See Also:
    • tuple

      public static <_1, _2, _3> Tuple3<_1,_2,_3> tuple(_1 _1, _2 _2, _3 _3)
      Static factory method for creating a 3-element HList.
      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 3-element HList
      See Also:
    • tuple

      public static <_1, _2, _3, _4> Tuple4<_1,_2,_3,_4> tuple(_1 _1, _2 _2, _3 _3, _4 _4)
      Static factory method for creating a 4-element HList.
      Type Parameters:
      _1 - the head element type
      _2 - the second element type
      _3 - the third element type
      _4 - the fourth element type
      Parameters:
      _1 - the head element
      _2 - the second element
      _3 - the third element
      _4 - the fourth element
      Returns:
      the 4-element HList
      See Also:
    • tuple

      public static <_1, _2, _3, _4, _5> Tuple5<_1,_2,_3,_4,_5> tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5)
      Static factory method for creating a 5-element HList.
      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 5-element HList
      See Also:
    • tuple

      public static <_1, _2, _3, _4, _5, _6> Tuple6<_1,_2,_3,_4,_5,_6> tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5, _6 _6)
      Static factory method for creating a 6-element HList.
      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
      _6 - the sixth element type
      Parameters:
      _1 - the head element
      _2 - the second element
      _3 - the third element
      _4 - the fourth element
      _5 - the fifth element
      _6 - the sixth element
      Returns:
      the 6-element HList
      See Also:
    • tuple

      public static <_1, _2, _3, _4, _5, _6, _7> Tuple7<_1,_2,_3,_4,_5,_6,_7> tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5, _6 _6, _7 _7)
      Static factory method for creating a 7-element HList.
      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
      _6 - the sixth element type
      _7 - the seventh element type
      Parameters:
      _1 - the head element
      _2 - the second element
      _3 - the third element
      _4 - the fourth element
      _5 - the fifth element
      _6 - the sixth element
      _7 - the seventh element
      Returns:
      the 7-element HList
      See Also:
    • tuple

      public static <_1, _2, _3, _4, _5, _6, _7, _8> Tuple8<_1,_2,_3,_4,_5,_6,_7,_8> tuple(_1 _1, _2 _2, _3 _3, _4 _4, _5 _5, _6 _6, _7 _7, _8 _8)
      Static factory method for creating an 8-element HList.
      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
      _6 - the sixth element type
      _7 - the seventh element type
      _8 - the eighth element type
      Parameters:
      _1 - the head element
      _2 - the second element
      _3 - the third element
      _4 - the fourth element
      _5 - the fifth element
      _6 - the sixth element
      _7 - the seventh element
      _8 - the eighth element
      Returns:
      the 8-element HList
      See Also: