Module

Data.List.NonEmpty

#toUnfoldable

#fromFoldable

fromFoldable :: forall f a. Foldable f => f a -> Maybe (NonEmptyList a)

#fromList

fromList :: forall a. List a -> Maybe (NonEmptyList a)

#singleton

singleton :: forall a. a -> NonEmptyList a

#length

length :: forall a. NonEmptyList a -> Int

#cons

cons :: forall a. a -> NonEmptyList a -> NonEmptyList a

#cons'

cons' :: forall a. a -> List a -> NonEmptyList a

#snoc

snoc :: forall a. NonEmptyList a -> a -> NonEmptyList a

#snoc'

snoc' :: forall a. List a -> a -> NonEmptyList a

#head

head :: forall a. NonEmptyList a -> a

#last

last :: forall a. NonEmptyList a -> a

#uncons

uncons :: forall a. NonEmptyList a -> { head :: a, tail :: List a }

#unsnoc

unsnoc :: forall a. NonEmptyList a -> { init :: List a, last :: a }

#(!!)

Operator alias for Data.List.NonEmpty.index (left-associative / precedence 8)

#index

index :: forall a. NonEmptyList a -> Int -> Maybe a

#elemIndex

elemIndex :: forall a. Eq a => a -> NonEmptyList a -> Maybe Int

#elemLastIndex

elemLastIndex :: forall a. Eq a => a -> NonEmptyList a -> Maybe Int

#findIndex

findIndex :: forall a. (a -> Boolean) -> NonEmptyList a -> Maybe Int

#findLastIndex

findLastIndex :: forall a. (a -> Boolean) -> NonEmptyList a -> Maybe Int

#insertAt

insertAt :: forall a. Int -> a -> NonEmptyList a -> Maybe (NonEmptyList a)

#updateAt

updateAt :: forall a. Int -> a -> NonEmptyList a -> Maybe (NonEmptyList a)

#modifyAt

modifyAt :: forall a. Int -> (a -> a) -> NonEmptyList a -> Maybe (NonEmptyList a)

#reverse

reverse :: forall a. NonEmptyList a -> NonEmptyList a

#concat

#concatMap

concatMap :: forall a b. (a -> NonEmptyList b) -> NonEmptyList a -> NonEmptyList b

#filter

filter :: forall a. (a -> Boolean) -> NonEmptyList a -> List a

#filterM

filterM :: forall m a. Monad m => (a -> m Boolean) -> NonEmptyList a -> m (List a)

#mapMaybe

mapMaybe :: forall a b. (a -> Maybe b) -> NonEmptyList a -> List b

#catMaybes

catMaybes :: forall a. NonEmptyList (Maybe a) -> List a

#appendFoldable

appendFoldable :: forall t a. Foldable t => NonEmptyList a -> t a -> NonEmptyList a

#sort

sort :: forall a. Ord a => NonEmptyList a -> NonEmptyList a

#sortBy

sortBy :: forall a. (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList a

#take

take :: forall a. Int -> NonEmptyList a -> List a

#takeWhile

takeWhile :: forall a. (a -> Boolean) -> NonEmptyList a -> List a

#drop

drop :: forall a. Int -> NonEmptyList a -> List a

#dropWhile

dropWhile :: forall a. (a -> Boolean) -> NonEmptyList a -> List a

#span

span :: forall a. (a -> Boolean) -> NonEmptyList a -> { init :: List a, rest :: List a }

#group

group :: forall a. Eq a => NonEmptyList a -> NonEmptyList (NonEmptyList a)

#groupAll

#groupBy

groupBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList (NonEmptyList a)

#groupAllBy

groupAllBy :: forall a. (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList (NonEmptyList a)

#partition

partition :: forall a. (a -> Boolean) -> NonEmptyList a -> { no :: List a, yes :: List a }

#nub

nub :: forall a. Ord a => NonEmptyList a -> NonEmptyList a

#nubBy

nubBy :: forall a. (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList a

#nubEq

nubEq :: forall a. Eq a => NonEmptyList a -> NonEmptyList a

#nubByEq

nubByEq :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList a

#union

union :: forall a. Eq a => NonEmptyList a -> NonEmptyList a -> NonEmptyList a

#unionBy

unionBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList a -> NonEmptyList a

#intersect

intersect :: forall a. Eq a => NonEmptyList a -> NonEmptyList a -> NonEmptyList a

#intersectBy

intersectBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList a -> NonEmptyList a

#zipWith

zipWith :: forall a b c. (a -> b -> c) -> NonEmptyList a -> NonEmptyList b -> NonEmptyList c

#zipWithA

zipWithA :: forall m a b c. Applicative m => (a -> b -> m c) -> NonEmptyList a -> NonEmptyList b -> m (NonEmptyList c)

#zip

zip :: forall a b. NonEmptyList a -> NonEmptyList b -> NonEmptyList (Tuple a b)

#unzip

unzip :: forall a b. NonEmptyList (Tuple a b) -> Tuple (NonEmptyList a) (NonEmptyList b)

#foldM

foldM :: forall m a b. Monad m => (b -> a -> m b) -> b -> NonEmptyList a -> m b

Re-exports from Data.Foldable

#foldMap

foldMap :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m

#foldl

foldl :: forall f a b. Foldable f => (b -> a -> b) -> b -> f a -> b

#foldr

foldr :: forall f a b. Foldable f => (a -> b -> b) -> b -> f a -> b

#notElem

notElem :: forall a f. Foldable f => Eq a => a -> f a -> Boolean

Test whether a value is not an element of a data structure.

#intercalate

intercalate :: forall f m. Foldable f => Monoid m => m -> f m -> m

Fold a data structure, accumulating values in some Monoid, combining adjacent elements using the specified separator.

For example:

> intercalate ", " ["Lorem", "ipsum", "dolor"]
= "Lorem, ipsum, dolor"

> intercalate "*" ["a", "b", "c"]
= "a*b*c"

> intercalate [1] [[2, 3], [4, 5], [6, 7]]
= [2, 3, 1, 4, 5, 1, 6, 7]

#fold

fold :: forall f m. Foldable f => Monoid m => f m -> m

Fold a data structure, accumulating values in some Monoid.

#findMap

findMap :: forall a b f. Foldable f => (a -> Maybe b) -> f a -> Maybe b

Try to find an element in a data structure which satisfies a predicate mapping.

#find

find :: forall a f. Foldable f => (a -> Boolean) -> f a -> Maybe a

Try to find an element in a data structure which satisfies a predicate.

#elem

elem :: forall a f. Foldable f => Eq a => a -> f a -> Boolean

Test whether a value is an element of a data structure.

#any

any :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b

any f is the same as or <<< map f; map a function over the structure, and then get the disjunction of the results.

#all

all :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b

all f is the same as and <<< map f; map a function over the structure, and then get the conjunction of the results.

Re-exports from Data.List.Types

Re-exports from Data.Semigroup.Foldable

#foldMap1

foldMap1 :: forall t a m. Foldable1 t => Semigroup m => (a -> m) -> t a -> m

#traverse1_

traverse1_ :: forall t f a b. Foldable1 t => Apply f => (a -> f b) -> t a -> f Unit

Traverse a data structure, performing some effects encoded by an Apply instance at each value, ignoring the final result.

#sequence1_

sequence1_ :: forall t f a. Foldable1 t => Apply f => t (f a) -> f Unit

Perform all of the effects in some data structure in the order given by the Foldable1 instance, ignoring the final result.

#for1_

for1_ :: forall t f a b. Foldable1 t => Apply f => t a -> (a -> f b) -> f Unit

A version of traverse1_ with its arguments flipped.

This can be useful when running an action written using do notation for every element in a data structure:

#fold1

fold1 :: forall t m. Foldable1 t => Semigroup m => t m -> m

Fold a data structure, accumulating values in some Semigroup.

Re-exports from Data.Semigroup.Traversable

#sequence1

sequence1 :: forall t b f. Traversable1 t => Apply f => t (f b) -> f (t b)

#traverse1

traverse1 :: forall t a b f. Traversable1 t => Apply f => (a -> f b) -> t a -> f (t b)

#traverse1Default

traverse1Default :: forall t a b m. Traversable1 t => Apply m => (a -> m b) -> t a -> m (t b)

A default implementation of traverse1 using sequence1.

Re-exports from Data.Traversable

#scanr

scanr :: forall a b f. Traversable f => (a -> b -> b) -> b -> f a -> f b

Fold a data structure from the right, keeping all intermediate results instead of only the final result. Note that the initial value does not appear in the result (unlike Haskell's Prelude.scanr).

scanr (+) 0 [1,2,3] = [6,5,3]
scanr (flip (-)) 10 [1,2,3] = [4,5,7]

#scanl

scanl :: forall a b f. Traversable f => (b -> a -> b) -> b -> f a -> f b

Fold a data structure from the left, keeping all intermediate results instead of only the final result. Note that the initial value does not appear in the result (unlike Haskell's Prelude.scanl).

scanl (+) 0  [1,2,3] = [1,3,6]
scanl (-) 10 [1,2,3] = [9,7,4]

Modules