Data.List.NonEmpty
- Package
- purescript-lists
- Repository
- purescript/purescript-lists
#toUnfoldable Source
toUnfoldable :: forall f. Unfoldable f => NonEmptyList ~> f
#fromFoldable Source
fromFoldable :: forall a f. 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 b a. (a -> NonEmptyList b) -> NonEmptyList a -> NonEmptyList b
#appendFoldable Source
appendFoldable :: forall a t. Foldable t => NonEmptyList a -> t a -> NonEmptyList a
#mapWithIndex Source
mapWithIndex :: forall b a. (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)
#group' Source
group' :: forall a. Ord a => NonEmptyList a -> NonEmptyList (NonEmptyList a)
#groupBy Source
groupBy :: forall 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. Eq a => NonEmptyList a -> NonEmptyList a
#nubBy Source
nubBy :: 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 c b a. (a -> b -> c) -> NonEmptyList a -> NonEmptyList b -> NonEmptyList c
#zipWithA Source
zipWithA :: forall c b a m. Applicative m => (a -> b -> m c) -> NonEmptyList a -> NonEmptyList b -> m (NonEmptyList c)
#zip Source
zip :: forall b a. NonEmptyList a -> NonEmptyList b -> NonEmptyList (Tuple a b)
#unzip Source
unzip :: forall b a. NonEmptyList (Tuple a b) -> Tuple (NonEmptyList a) (NonEmptyList b)
#foldM Source
foldM :: forall b a m. Monad m => (a -> b -> m a) -> a -> NonEmptyList b -> m a
Re-exports from Data.Foldable
#intercalate Source
intercalate :: forall m f. 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 f b a. 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 f b a. 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)
(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 b a f t. 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 a f t. 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 f b. Traversable1 t => Apply f => t (f b) -> f (t b)
#traverse1 Source
traverse1 :: forall t f b a. Traversable1 t => Apply f => (a -> f b) -> t a -> f (t b)
#traverse1Default Source
traverse1Default :: forall m b a t. 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 f b a. 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 f b a. 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]