Skip to content

Commit 80a0fdb

Browse files
committed
Documenting HList subtypes
1 parent a0e1403 commit 80a0fdb

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

  • src/main/java/com/jnape/palatable/lambda/adt/hlist

‎src/main/java/com/jnape/palatable/lambda/adt/hlist/HList.java‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ public static <_1, _2, _3, _4, _5> Tuple5<_1, _2, _3, _4, _5> tuple(_1 _1, _2 _2
134134
return tuple(_2, _3, _4, _5).cons(_1);
135135
}
136136

137+
/**
138+
* The consing of a head element to a tail <code>HList</code>.
139+
*
140+
* @param <Head> the head element type
141+
* @param <Tail> the HList tail type
142+
*/
137143
public static class HCons<Head, Tail extends HList<?, ?>> extends HList<Head, Tail> {
138144
private final Head head;
139145
private final Tail tail;
@@ -143,10 +149,20 @@ public static class HCons<Head, Tail extends HList<?, ?>> extends HList<Head, Ta
143149
this.tail = tail;
144150
}
145151

152+
/**
153+
* The head element of the <code>HList</code>.
154+
*
155+
* @return the head element
156+
*/
146157
public Head head() {
147158
return head;
148159
}
149160

161+
/**
162+
* The remaining tail of the <code>HList</code>; returns an HNil if this is the last element.
163+
*
164+
* @return the tail
165+
*/
150166
public Tail tail() {
151167
return tail;
152168
}
@@ -180,6 +196,9 @@ public final String toString() {
180196
}
181197
}
182198

199+
/**
200+
* The empty <code>HList</code>.
201+
*/
183202
public static final class HNil extends HList<Void, HNil> {
184203
private static final HNil INSTANCE = new HNil();
185204

0 commit comments

Comments
 (0)