non-empty-0.2.1: 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

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

Choose [] 
Choose T 
Choose f => Choose (T f)