Nel
enum Nel[a: Type]Sourcecase Nel(a, List[a])The NonEmptyList type.
Instances
instance Applicative[Nel]Sourceinstance Formattable[Nel[a]] with Formattable[a]Sourceinstance Traversable[Nel]Sourceinstance UnorderedFoldable[Nel]SourceDefinitions
Apply every function from f to every argument from l and return a non-empty list with all results.
For f = f1, f2, ... and x = x1, x2, ... the results appear in the order
f1(x1), f1(x2), ..., f2(x1), f2(x2), ....
Returns the non-empty list l prefixed with the new element x.
Returns the number of elements in l that satisfy the predicate f.
Returns l without the longest prefix that satisfies the predicate f.
Returns true if and only if at least one element in l satisfies the predicate f.
Returns a list of every element in l that satisfies the predicate f.
Optionally returns the first element of l that satisfies the predicate f when searching from left to right.
Optionally returns the first element of l that satisfies the predicate f when searching from right to left.
Returns the result of applying f to every element in l and concatenating the results.
Returns the result of applying combine to all the elements in l, using empty as the initial value.
Applies f to a start value s and all elements in l going from left to right.
That is, the result is of the form: f(...f(f(s, x1), x2)..., xn).
Returns the result of mapping each element and combining the results.
Applies f to a start value s and all elements in l going from right to left.
That is, the result is of the form: f(x1, ...f(xn-1, f(xn, s))...).
Returns true if and only if all elements in l satisfy the predicate f.
Applies f to every element of l along with that element's index.
Returns the element at position i in the non-empty list l.
Throws IndexOutOfBoundsException if the index is out of bounds.
Returns a range of all valid indices of the non-empty list l.
Returns l with a inserted between every two adjacent elements.
Build a non-empty list by applying f to the initial value x.
f should return Some(a1) to signal a new element a1 (which also becomes the next input to f).
f should return None to signal the end of building the list.
Returns None if f(x) immediately returns None.
Returns the concatenation of the string representation
of each element in l with sep inserted between each element.
Returns the concatenation of the string representation
of each element in l according to f with sep inserted between each element.
Returns the result of applying f to every element in l.
That is, the result is of the form: f(x1) :: f(x2) :: ....
Returns the result of applying f to every element in l along with that element's index.
That is, the result is of the form: f(0, x0) :: f(1, x1) :: ....
Finds the largest element of l according to the Order on a.
Finds the largest element of l according to the given comparator cmp.
Returns true if and only if l contains the element a.
Finds the smallest element of l according to the Order on a.
Finds the smallest element of l according to the given comparator cmp.
Optionally returns the element at position i in the non-empty list l.
Returns all permutations of l in lexicographical order by element indices in l.
That is, l is the first permutation and reverse(l) is the last permutation.
Applies combine to all elements in l until a single value is obtained.
Applies f to all elements in l going from left to right until a single value v is obtained.
That is, the result is of the form: f(...f(f(x1, x2), x3)..., xn)
Left-associative reduction of a structure.
Applies g to the initial element of l and combines it
with the remainder of l using f going from left to right.
Applies f to all elements in l going from right to left until a single value v is obtained.
That is, the result is of the form: f(x1, ...f(xn-2, f(xn-1, xn))...)
Right-associative reduction of a structure.
Applies g to the initial element of l and combines it
with the remainder of l using f going from right to left.
Returns l with every occurrence of src replaced by dst.
def sequence(l: Nel[m[a]]): m[Nel[a]] with Applicative[m]§ SourceReturns the result of applying the applicative mapping function f to all the elements of the
non-empty list l.
Optionally returns the Nel l shuffled using the Fisher–Yates shuffle.
Sort the non-empty list l so that elements are ordered from low to high according
to their Order instance.
The sort is not stable, i.e., equal elements may appear in a different order than in the input l.
The sort implementation is a Quicksort.
Sort the non-empty list l so that elements are ordered from low to high according
to the Order instance for the values obtained by applying f to each element.
The sort is not stable, i.e., equal elements may appear in a different order than in the input l.
The sort implementation is a Quicksort.
Sort the non-empty list l so that elements are ordered from low to high according
to the comparison function cmp.
The sort is not stable, i.e., equal elements may appear in a different order than in the input l.
The sort implementation is a Quicksort.
Returns all subsequences of l in lexicographical order by element indices in l.
That is, l is the first subsequence and Nil is the last subsequence.
Returns the sum of all elements in the list l according to the function f.
Returns the longest prefix of l that satisfies the predicate f.
Returns a map with elements of l as keys and f applied as values.
If l contains multiple mappings with the same key, toMapWith does not
make any guarantees about which mapping will be in the resulting map.
Returns a string representation of the given non-empty list l.
def traverse(f: a -> m[b] \ ef, l: Nel[a]): m[Nel[b]] \ ef with Applicative[m]§ SourceReturns the result of running all the actions in the non-empty list l.
Build a non-empty list by applying f to the seed value st.
f should return Some(a, st1) to signal a new element a and a new seed value st1.
f should return None to signal the end of building the list.
The first element is produced from the initial seed, so the result is always non-empty
only if f(st) returns Some. Returns None if f(st) immediately returns None.
Build a non-empty list by applying the function next to (). next is expected to encapsulate
a stateful resource such as a file handle that can be iterated.
next should return Some(a) to signal a new element a.
next should return None to signal the end of building the list.
Returns None if next immediately returns None.
Returns a pair of non-empty lists, the first containing all first components in l
and the second containing all second components in l.
Returns a non-empty list where the element at index i is (a, b) where
a is the element at index i in l1 and b is the element at index i in l2.
If either l1 or l2 becomes depleted, then no further elements are added to the resulting list.
Returns a non-empty list where the element at index i is f(a, b) where
a is the element at index i in l1 and b is the element at index i in l2.
If either l1 or l2 becomes depleted, then no further elements are added to the resulting list.
def zipWithA(f: a -> (b -> m[c] \ ef), xs: Nel[a], ys: Nel[b]): m[Nel[c]] \ ef with Applicative[m]§ SourceGeneralize zipWith to an applicative functor f.