non-empty-0.2: List-like structures with static restrictions on the number of elements

Safe HaskellNone

Data.NonEmpty.Class

Synopsis

Documentation

class Empty f whereSource

Methods

empty :: f aSource

Instances

class Cons f whereSource

Methods

cons :: a -> f a -> f aSource

Instances

Cons [] 
Cons Seq 
Cons f => Cons (T f) 
(Cons f, Empty f) => Cons (T f) 

class Snoc f whereSource

Methods

snoc :: f a -> a -> f aSource

Instances

Snoc [] 
Snoc Seq 
Snoc f => Snoc (T f) 

snocDefault :: (Cons f, Traversable f) => f a -> a -> f aSource

class ViewL f whereSource

Methods

viewL :: f a -> Maybe (a, f a)Source

Instances

class ViewR f whereSource

Methods

viewR :: f a -> Maybe (f a, a)Source

Instances

class (ViewL f, ViewR f) => View f Source

Instances

viewRDefault :: (ViewL f, Traversable f) => f a -> Maybe (f a, a)Source

class Singleton f whereSource

Methods

singleton :: a -> f aSource

class Append f whereSource

Methods

append :: f a -> f a -> f aSource

Instances

Append [] 
Append Seq 
(Cons f, Append f) => Append (T f) 

class Functor f => Zip f whereSource

It must hold:

 fmap f xs
    = zipWith (\x _ -> f x) xs xs
    = zipWith (\_ x -> f x) xs xs

Methods

zipWith :: (a -> b -> c) -> f a -> f b -> f cSource

Instances

Zip [] 
Zip Maybe 
Zip Seq 
Zip T 
Zip f => Zip (T f) 
Zip f => Zip (T f) 

zipWith3 :: Zip f => (a -> b -> c -> d) -> f a -> f b -> f c -> f dSource

zipWith4 :: Zip f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f eSource

zip :: Zip f => f a -> f b -> f (a, b)Source

zip3 :: Zip f => f a -> f b -> f c -> f (a, b, c)Source

zip4 :: Zip f => f a -> f b -> f c -> f d -> f (a, b, c, d)Source

class Repeat f whereSource

Methods

repeat :: a -> f aSource

Create a container with as many copies as possible of a given value. That is, for a container with fixed size n, the call repeat x will generate a container with n copies of x.

Instances

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

class Repeat f => Iterate f whereSource

Methods

iterate :: (a -> a) -> a -> f aSource

Instances

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

class Sort f whereSource

We need to distinguish between Sort and SortBy, since there is an instance Sort Set but there cannot be an instance SortBy Set.

Methods

sort :: Ord a => f a -> f aSource

Instances

Sort [] 
Sort Maybe 
Sort Seq 
Sort Set 
Sort T 
(Sort f, InsertBy f) => Sort (T f)

If you nest too many non-empty lists then the efficient merge-sort (linear-logarithmic runtime) will degenerate to an inefficient insert-sort (quadratic runtime).

(Insert f, Sort f) => Sort (T f) 

sortDefault :: (Ord a, SortBy f) => f a -> f aSource

Default implementation for sort based on sortBy.

class Sort f => SortBy f whereSource

Methods

sortBy :: (a -> a -> Ordering) -> f a -> f aSource

Instances

SortBy [] 
SortBy Maybe 
SortBy Seq 
SortBy T 
(SortBy f, InsertBy f) => SortBy (T f) 
(InsertBy f, SortBy f) => SortBy (T f) 

class Reverse f whereSource

Methods

reverse :: f a -> f aSource

Instances

class Show f whereSource

Methods

showsPrec :: Show a => Int -> f a -> ShowSSource

Instances

Show [] 
Show Set 
Show T 
Show f => Show (T f) 
Show f => Show (T f) 

class Arbitrary f whereSource

Methods

arbitrary :: Arbitrary a => Gen (f a)Source

shrink :: Arbitrary a => f a -> [f a]Source

Instances