non-empty-0.3.5: List-like structures with static restrictions on the number of elements
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.NonEmpty.Mixed

Description

Functions that cope both with plain and non-empty structures.

If there are two versions of a function, where one works on fixed-length lists, then place the fixed-length list variant in NonEmpty and the other one here.

Synopsis

Documentation

groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [T [] a] Source #

groupPairs :: (Foldable f, Eq a) => f (a, b) -> [(a, T [] b)] Source #

groupKey :: (Foldable f, Eq a) => (b -> a) -> f b -> [(a, T [] b)] Source #

groupEithers :: Foldable f => f (Either a b) -> [Either (T [] a) (T [] b)] Source #

segmentAfter :: Foldable f => (a -> Bool) -> f a -> ([T [] a], [a]) Source #

segmentBefore :: Foldable f => (a -> Bool) -> f a -> ([a], [T [] a]) Source #

filterToInfixes :: Foldable f => (a -> Bool) -> f a -> [T [] a] Source #

mapAdjacent :: (Cons f, Zip f) => (a -> a -> b) -> T f a -> f b Source #

take :: (View g, Repeat f, Traversable f) => g a -> Maybe (f a) Source #

splitAt :: (View g, Repeat f, Traversable f) => g a -> (Maybe (f a), g a) Source #

sliceVertical :: (View g, Repeat f, Traversable f) => g a -> ([f a], g a) Source #

viewR :: (ViewR f, Empty f, Cons f) => T f a -> (f a, a) Source #

This implementation is more efficient for Sequence than viewR.

init :: (ViewR f, Empty f, Cons f) => T f a -> f a Source #

last :: ViewR f => T f a -> a Source #

tails :: (ViewL f, Empty f) => f a -> T [] (f a) Source #

inits :: (ViewL f, Cons f, Empty f) => f a -> T [] (f a) Source #

appendLeft :: Cons f => [a] -> f a -> f a Source #

iterate :: (Repeat f, Traversable f) => (a -> a) -> a -> f a Source #

class Choose f where Source #

Methods

choose :: [a] -> [f a] Source #

Select tuples of list elements: choose "abc" == [a!:b!:empty,a!:c!:empty,b!:c!:empty]

Instances

Instances details
Choose T Source # 
Instance details

Defined in Data.NonEmpty.Mixed

Methods

choose :: [a] -> [T a] Source #

Choose [] Source # 
Instance details

Defined in Data.NonEmpty.Mixed

Methods

choose :: [a] -> [[a]] Source #

Choose f => Choose (T f) Source # 
Instance details

Defined in Data.NonEmpty.Mixed

Methods

choose :: [a] -> [T f a] Source #