Class HList
java.lang.Object
com.jnape.palatable.lambda.adt.hlist.HList
- Direct Known Subclasses:
HList.HCons
,HList.HNil
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 ClassesModifier and TypeClassDescriptionstatic class
HList.HCons<Head,
Tail extends HList> The consing of a head element to a tailHList
.static final class
The emptyHList
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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
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.
-
Constructor Details
-
HList
private HList()
-
-
Method Details
-
cons
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
-
nil
Static factory method for creating empty HLists.- Returns:
- an empty HList
-
cons
Static factory method for creating an HList from the given head and tail.- Type Parameters:
Head
- the head typeTail
- the tail type- Parameters:
head
- the head elementtail
- the tail HList- Returns:
- the newly created HList
-
singletonHList
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
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
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
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
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, Tuple6<_1,_3, _4, _5, _6> _2, tuple_3, _4, _5, _6> (_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, Tuple7<_1,_3, _4, _5, _6, _7> _2, tuple_3, _4, _5, _6, _7> (_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, Tuple8<_1,_3, _4, _5, _6, _7, _8> _2, tuple_3, _4, _5, _6, _7, _8> (_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:
-