nonemptylist library

Classes

NonEmptyList<T>
A list that is guaranteed to have at least one item.

Functions

ap<A, B>(NonEmptyList<B Function(A)> fns) → NonEmptyList<B> Function(NonEmptyList<A>)
Applies each function in the fns NonEmptyList to each item in the List.
append<T>(T item) → NonEmptyList<T> Function(NonEmptyList<T>)
Appends an item to the end of a NonEmptyList.
flatMap<A, B>(NonEmptyList<B> f(A)) → NonEmptyList<B> Function(NonEmptyList<A>)
Maps over the items of the NonEmptyList using function f, then flattens the result.
group<A>(Eq<A> eq) → List<NonEmptyList<A>> Function(NonEmptyList<A>)
Groups consecutive similar items based on the equality eq.
groupBy<A, K>(K keyFunc(A)) → Map<K, NonEmptyList<A>> Function(NonEmptyList<A>)
Groups items by a derived key, as determined by the keyFunc.
Returns the first item of the list.
isNonEmpty<T>(List<T> list) → bool
Checks whether the given list is not empty.
map<A, B>(B f(A)) → NonEmptyList<B> Function(NonEmptyList<A>)
Maps over the items of the NonEmptyList using function f.
of<T>(Iterable<T> items) → NonEmptyList<T>
prepend<T>(T item) → NonEmptyList<T> Function(NonEmptyList<T>)
Prepends an item to the beginning of a NonEmptyList.
reverse<A>(NonEmptyList<A> list) → NonEmptyList<A>
Returns a new NonEmptyList with reversed items.
tail<T>(NonEmptyList<T> list) → List<T>
Returns all items from list except the first.
union<A>(Eq<A> eq) → NonEmptyList<A> Function(NonEmptyList<A>) Function(NonEmptyList<A>)
Combines two NonEmptyLists while removing duplicates based on the equality eq.
unique<A>(Eq<A> eq) → NonEmptyList<A> Function(NonEmptyList<A>)
Returns a new NonEmptyList with unique items based on the equality eq.