Class HList

  • Direct Known Subclasses:
    HList.HCons, HList.HNil

    public abstract class HList
    extends java.lang.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:
    SingletonHList, Tuple2, Tuple3, Tuple4, Tuple5, Tuple6
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  HList.HCons<Head,​Tail extends HList>
      The consing of a head element to a tail HList.
      static class  HList.HNil
      The empty HList.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HList()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      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.
      java.lang.String toString()  
      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 Detail

      • HList

        private HList()
    • Method Detail

      • 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • nil

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

        public static <Head,​Tail extends HListHList.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:
        Tuple2
      • 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:
        Tuple3
      • 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:
        Tuple4
      • 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:
        Tuple5
      • 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:
        Tuple6
      • 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:
        Tuple7
      • 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:
        Tuple8