head<T> function

T head<T>(
  1. NonEmptyList<T> list
)

Returns the first item of the list.

var nel = NonEmptyList([1, 2, 3]);
print(head(nel));  // 1

Implementation

T head<T>(NonEmptyList<T> list) {
  return list._items.first;
}