Returns a Just NonEmptyList
if the parameter has one or more elements, otherwise it returns Nothing
Converts a Tuple
to a NonEmptyList
The same function as List#head
, but it doesn't return a Maybe as a NonEmptyList will always have a head
Returns true and narrows the type if the passed array has one or more elements
The same function as List#last
, but it doesn't return a Maybe as a NonEmptyList will always have a last element
The same function as List#tail
, but it doesn't return a Maybe as a NonEmptyList will always have a tail (although it may be of length 0)
Typecasts any array into a NonEmptyList
, but throws an exception if the array is empty. Use fromArray
as a safe alternative
Typecasts an array with at least one element into a
NonEmptyList
. Works only if the compiler can confirm that the array has one or more elements