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

Safe HaskellSafe
LanguageHaskell98

Data.NonEmpty.Set

Synopsis

Documentation

data T a Source #

Instances
NFData T Source # 
Instance details

Defined in Data.NonEmpty.Set

Methods

rnf :: NFData a => T a -> () Source #

Eq a => Eq (T a) Source # 
Instance details

Defined in Data.NonEmpty.Set

Methods

(==) :: T a -> T a -> Bool #

(/=) :: T a -> T a -> Bool #

Ord a => Ord (T a) Source # 
Instance details

Defined in Data.NonEmpty.Set

Methods

compare :: T a -> T a -> Ordering #

(<) :: T a -> T a -> Bool #

(<=) :: T a -> T a -> Bool #

(>) :: T a -> T a -> Bool #

(>=) :: T a -> T a -> Bool #

max :: T a -> T a -> T a #

min :: T a -> T a -> T a #

Show a => Show (T a) Source # 
Instance details

Defined in Data.NonEmpty.Set

Methods

showsPrec :: Int -> T a -> ShowS #

show :: T a -> String #

showList :: [T a] -> ShowS #

NFData a => NFData (T a) Source # 
Instance details

Defined in Data.NonEmpty.Set

Methods

rnf :: T a -> () #

insert :: Ord a => a -> Set a -> T a Source #

We cannot have a reasonable instance Insert Set, since the instance Insert (NonEmpty Set) would preserve duplicate leading elements, whereas Set does not.

However, the instance Insert NonEmpty is not the problem. A general type like

insertSet :: (Insert f, Ord a) => a -> f a -> NonEmpty f a

cannot work, since it can be instantiated to

insertSet :: (Ord a) => a -> NonEmpty Set a -> NonEmpty (NonEmpty Set) a

and this is obviously wrong: insertSet x (singleton x) has only one element, not two.

singleton :: a -> T a Source #

member :: Ord a => a -> T a -> Bool Source #

size :: T a -> Int Source #

fromList :: Ord a => T [] a -> T a Source #

fromAscList :: Ord a => T [] a -> T a Source #

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

fetch :: Ord a => Set a -> Maybe (T a) Source #

flatten :: Ord a => T a -> Set a Source #

union :: Ord a => T a -> T a -> T a Source #

unionLeft :: Ord a => Set a -> T a -> T a Source #

unionRight :: Ord a => T a -> Set a -> T a Source #

findMin :: T a -> a Source #

findMax :: T a -> a Source #

delete :: Ord k => k -> T k -> Set k Source #

deleteMin :: T a -> Set a Source #

deleteMax :: Ord a => T a -> Set a Source #

deleteFindMin :: T a -> (a, Set a) Source #

deleteFindMax :: Ord a => T a -> (a, Set a) Source #

minView :: T a -> (a, Set a) Source #

maxView :: Ord a => T a -> (a, Set a) Source #