Data.List.NonEmpty
- Package
- lists
- Repository
- purescript/purescript-lists
#toUnfoldable Source
toUnfoldable :: forall f. Unfoldable f => NonEmptyList ~> f
#fromFoldable Source
fromFoldable :: forall f a. Foldable f => f a -> Maybe (NonEmptyList a)
#singleton Source
singleton :: forall a. a -> NonEmptyList a
#length Source
length :: forall a. NonEmptyList a -> Int
#cons Source
cons :: forall a. a -> NonEmptyList a -> NonEmptyList a
#cons' Source
cons' :: forall a. a -> List a -> NonEmptyList a
#snoc Source
snoc :: forall a. NonEmptyList a -> a -> NonEmptyList a
#snoc' Source
snoc' :: forall a. List a -> a -> NonEmptyList a
#head Source
head :: forall a. NonEmptyList a -> a
#last Source
last :: forall a. NonEmptyList a -> a
#uncons Source
uncons :: forall a. NonEmptyList a -> { head :: a, tail :: List a }
#unsnoc Source
unsnoc :: forall a. NonEmptyList a -> { init :: List a, last :: a }
#elemLastIndex Source
elemLastIndex :: forall a. Eq a => a -> NonEmptyList a -> Maybe Int
#findLastIndex Source
findLastIndex :: forall a. (a -> Boolean) -> NonEmptyList a -> Maybe Int
#insertAt Source
insertAt :: forall a. Int -> a -> NonEmptyList a -> Maybe (NonEmptyList a)
#updateAt Source
updateAt :: forall a. Int -> a -> NonEmptyList a -> Maybe (NonEmptyList a)
#modifyAt Source
modifyAt :: forall a. Int -> (a -> a) -> NonEmptyList a -> Maybe (NonEmptyList a)
#reverse Source
reverse :: forall a. NonEmptyList a -> NonEmptyList a
#concat Source
concat :: forall a. NonEmptyList (NonEmptyList a) -> NonEmptyList a
#concatMap Source
concatMap :: forall a b. (a -> NonEmptyList b) -> NonEmptyList a -> NonEmptyList b
#appendFoldable Source
appendFoldable :: forall t a. Foldable t => NonEmptyList a -> t a -> NonEmptyList a
#mapWithIndex Source
mapWithIndex :: forall a b. (Int -> a -> b) -> NonEmptyList a -> NonEmptyList b
Apply a function to each element and its index in a list starting at 0.
Deprecated. Use Data.FunctorWithIndex instead.
#sort Source
sort :: forall a. Ord a => NonEmptyList a -> NonEmptyList a
#sortBy Source
sortBy :: forall a. (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList a
#span Source
span :: forall a. (a -> Boolean) -> NonEmptyList a -> { init :: List a, rest :: List a }
#group Source
group :: forall a. Eq a => NonEmptyList a -> NonEmptyList (NonEmptyList a)
#groupAll Source
groupAll :: forall a. Ord a => NonEmptyList a -> NonEmptyList (NonEmptyList a)
#group' Source
group' :: forall a. Warn (Text "\'group\'\' is deprecated, use groupAll instead") => Ord a => NonEmptyList a -> NonEmptyList (NonEmptyList a)
#groupBy Source
groupBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList (NonEmptyList a)
#groupAllBy Source
groupAllBy :: forall a. Ord a => (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList (NonEmptyList a)
#partition Source
partition :: forall a. (a -> Boolean) -> NonEmptyList a -> { no :: List a, yes :: List a }
#nub Source
nub :: forall a. Ord a => NonEmptyList a -> NonEmptyList a
#nubBy Source
nubBy :: forall a. (a -> a -> Ordering) -> NonEmptyList a -> NonEmptyList a
#nubEq Source
nubEq :: forall a. Eq a => NonEmptyList a -> NonEmptyList a
#nubByEq Source
nubByEq :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList a
#union Source
union :: forall a. Eq a => NonEmptyList a -> NonEmptyList a -> NonEmptyList a
#unionBy Source
unionBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList a -> NonEmptyList a
#intersect Source
intersect :: forall a. Eq a => NonEmptyList a -> NonEmptyList a -> NonEmptyList a
#intersectBy Source
intersectBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList a -> NonEmptyList a
#zipWith Source
zipWith :: forall a b c. (a -> b -> c) -> NonEmptyList a -> NonEmptyList b -> NonEmptyList c
#zipWithA Source
zipWithA :: forall m a b c. Applicative m => (a -> b -> m c) -> NonEmptyList a -> NonEmptyList b -> m (NonEmptyList c)
#zip Source
zip :: forall a b. NonEmptyList a -> NonEmptyList b -> NonEmptyList (Tuple a b)
#unzip Source
unzip :: forall a b. NonEmptyList (Tuple a b) -> Tuple (NonEmptyList a) (NonEmptyList b)
#foldM Source
foldM :: forall m a b. Monad m => (b -> a -> m b) -> b -> NonEmptyList a -> m b
Re-exports from Data.Foldable
#intercalate Source
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]
#any Source
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 Source
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
#NonEmptyList Source
newtype NonEmptyList a
Constructors
NonEmptyList (NonEmpty List a)
Instances
Newtype (NonEmptyList a) _
(Eq a) => Eq (NonEmptyList a)
(Ord a) => Ord (NonEmptyList a)
Eq1 NonEmptyList
Ord1 NonEmptyList
(Show a) => Show (NonEmptyList a)
Functor NonEmptyList
Apply NonEmptyList
Applicative NonEmptyList
Bind NonEmptyList
Monad NonEmptyList
Alt NonEmptyList
Extend NonEmptyList
Comonad NonEmptyList
Semigroup (NonEmptyList a)
Foldable NonEmptyList
Traversable NonEmptyList
Foldable1 NonEmptyList
Unfoldable1 NonEmptyList
FunctorWithIndex Int NonEmptyList
FoldableWithIndex Int NonEmptyList
TraversableWithIndex Int NonEmptyList
Traversable1 NonEmptyList
Re-exports from Data.Semigroup.Foldable
#traverse1_ Source
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_ Source
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.
Re-exports from Data.Semigroup.Traversable
#sequence1 Source
sequence1 :: forall t b f. Traversable1 t => Apply f => t (f b) -> f (t b)
#traverse1 Source
traverse1 :: forall t a b f. Traversable1 t => Apply f => (a -> f b) -> t a -> f (t b)
#traverse1Default Source
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 Source
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 Source
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]