Module

Data.Array.NonEmpty

Package
purescript-arrays
Repository
purescript/purescript-arrays

#fromArray Source

fromArray :: forall a. Array a -> Maybe (NonEmptyArray a)

#fromNonEmpty Source

#toArray Source

toArray :: forall a. NonEmptyArray a -> Array a

#toNonEmpty Source

#fromFoldable Source

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

#fromFoldable1 Source

fromFoldable1 :: forall a f. Foldable1 f => f a -> NonEmptyArray a

#toUnfoldable Source

toUnfoldable :: forall a f. Unfoldable f => NonEmptyArray a -> f a

#singleton Source

singleton :: forall a. a -> NonEmptyArray a

#(..) Source

Operator alias for Data.Array.NonEmpty.range (non-associative / precedence 8)

#replicate Source

replicate :: forall a. Int -> a -> NonEmptyArray a

Replicate an item at least once

#some Source

some :: forall a f. Alternative f => Lazy (f (Array a)) => f a -> f (NonEmptyArray a)

#length Source

length :: forall a. NonEmptyArray a -> Int

#(:) Source

Operator alias for Data.Array.NonEmpty.cons (right-associative / precedence 6)

#cons Source

cons :: forall a. a -> NonEmptyArray a -> NonEmptyArray a

#cons' Source

cons' :: forall a. a -> Array a -> NonEmptyArray a

#snoc Source

snoc :: forall a. NonEmptyArray a -> a -> NonEmptyArray a

#snoc' Source

snoc' :: forall a. Array a -> a -> NonEmptyArray a

#appendArray Source

appendArray :: forall a. NonEmptyArray a -> Array a -> NonEmptyArray a

#insert Source

insert :: forall a. Ord a => a -> NonEmptyArray a -> NonEmptyArray a

#insertBy Source

insertBy :: forall a. (a -> a -> Ordering) -> a -> NonEmptyArray a -> NonEmptyArray a

#head Source

head :: forall a. NonEmptyArray a -> a

#last Source

last :: forall a. NonEmptyArray a -> a

#tail Source

tail :: forall a. NonEmptyArray a -> Array a

#init Source

init :: forall a. NonEmptyArray a -> Array a

#uncons Source

uncons :: forall a. NonEmptyArray a -> { head :: a, tail :: Array a }

#unsnoc Source

unsnoc :: forall a. NonEmptyArray a -> { init :: Array a, last :: a }

#(!!) Source

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

#index Source

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

#elemIndex Source

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

#elemLastIndex Source

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

#findIndex Source

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

#findLastIndex Source

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

#insertAt Source

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

#deleteAt Source

deleteAt :: forall a. Int -> NonEmptyArray a -> Maybe (Array a)

#updateAt Source

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

#updateAtIndices Source

updateAtIndices :: forall a t. Foldable t => t (Tuple Int a) -> NonEmptyArray a -> NonEmptyArray a

#modifyAt Source

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

#modifyAtIndices Source

modifyAtIndices :: forall a t. Foldable t => t Int -> (a -> a) -> NonEmptyArray a -> NonEmptyArray a

#alterAt Source

alterAt :: forall a. Int -> (a -> Maybe a) -> NonEmptyArray a -> Maybe (Array a)

#reverse Source

reverse :: forall a. NonEmptyArray a -> NonEmptyArray a

#concatMap Source

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

#filter Source

filter :: forall a. (a -> Boolean) -> NonEmptyArray a -> Array a

#partition Source

partition :: forall a. (a -> Boolean) -> NonEmptyArray a -> { no :: Array a, yes :: Array a }

#filterA Source

filterA :: forall f a. Applicative f => (a -> f Boolean) -> NonEmptyArray a -> f (Array a)

#mapMaybe Source

mapMaybe :: forall b a. (a -> Maybe b) -> NonEmptyArray a -> Array b

#catMaybes Source

catMaybes :: forall a. NonEmptyArray (Maybe a) -> Array a

#sort Source

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

#sortBy Source

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

#sortWith Source

sortWith :: forall b a. Ord b => (a -> b) -> NonEmptyArray a -> NonEmptyArray a

#slice Source

slice :: forall a. Int -> Int -> NonEmptyArray a -> Array a

#take Source

take :: forall a. Int -> NonEmptyArray a -> Array a

#takeEnd Source

takeEnd :: forall a. Int -> NonEmptyArray a -> Array a

#takeWhile Source

takeWhile :: forall a. (a -> Boolean) -> NonEmptyArray a -> Array a

#drop Source

drop :: forall a. Int -> NonEmptyArray a -> Array a

#dropEnd Source

dropEnd :: forall a. Int -> NonEmptyArray a -> Array a

#dropWhile Source

dropWhile :: forall a. (a -> Boolean) -> NonEmptyArray a -> Array a

#span Source

span :: forall a. (a -> Boolean) -> NonEmptyArray a -> { init :: Array a, rest :: Array a }

#nub Source

nub :: forall a. Eq a => NonEmptyArray a -> NonEmptyArray a

#nubBy Source

nubBy :: forall a. (a -> a -> Boolean) -> NonEmptyArray a -> NonEmptyArray a

#union Source

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

#union' Source

union' :: forall a. Eq a => NonEmptyArray a -> Array a -> NonEmptyArray a

#unionBy Source

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

#unionBy' Source

unionBy' :: forall a. (a -> a -> Boolean) -> NonEmptyArray a -> Array a -> NonEmptyArray a

#delete Source

delete :: forall a. Eq a => a -> NonEmptyArray a -> Array a

#deleteBy Source

deleteBy :: forall a. (a -> a -> Boolean) -> a -> NonEmptyArray a -> Array a

#(\\) Source

Operator alias for Data.Array.NonEmpty.difference (non-associative / precedence 5)

#difference Source

difference :: forall a. Eq a => NonEmptyArray a -> NonEmptyArray a -> Array a

#difference' Source

difference' :: forall a. Eq a => NonEmptyArray a -> Array a -> Array a

#intersect Source

intersect :: forall a. Eq a => NonEmptyArray a -> NonEmptyArray a -> Array a

#intersect' Source

intersect' :: forall a. Eq a => NonEmptyArray a -> Array a -> Array a

#intersectBy Source

intersectBy :: forall a. (a -> a -> Boolean) -> NonEmptyArray a -> NonEmptyArray a -> Array a

#intersectBy' Source

intersectBy' :: forall a. (a -> a -> Boolean) -> NonEmptyArray a -> Array a -> Array a

#zipWith Source

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

#zipWithA Source

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

#zip Source

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

#unzip Source

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

#foldM Source

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

#foldRecM Source

foldRecM :: forall b a m. MonadRec m => (a -> b -> m a) -> a -> NonEmptyArray b -> m a

#unsafeIndex Source

unsafeIndex :: forall a. Partial => NonEmptyArray a -> Int -> a