primitive-containers-0.3.0: containers backed by arrays

Safe HaskellNone
LanguageHaskell2010

Data.Diet.Set.Lifted

Contents

Synopsis

Documentation

newtype Set a Source #

A diet set. Currently, the data constructor for this type is exported. Please do not use it. It will be moved to an internal module at some point.

Constructors

Set (Set Array a) 
Instances
(Ord a, Enum a) => IsList (Set a) Source # 
Instance details

Defined in Data.Diet.Set.Lifted

Associated Types

type Item (Set a) :: * #

Methods

fromList :: [Item (Set a)] -> Set a #

fromListN :: Int -> [Item (Set a)] -> Set a #

toList :: Set a -> [Item (Set a)] #

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

Defined in Data.Diet.Set.Lifted

Methods

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

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

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

Defined in Data.Diet.Set.Lifted

Methods

compare :: Set a -> Set a -> Ordering #

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

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

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

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

max :: Set a -> Set a -> Set a #

min :: Set a -> Set a -> Set a #

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

Defined in Data.Diet.Set.Lifted

Methods

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

show :: Set a -> String #

showList :: [Set a] -> ShowS #

(Ord a, Enum a) => Semigroup (Set a) Source # 
Instance details

Defined in Data.Diet.Set.Lifted

Methods

(<>) :: Set a -> Set a -> Set a #

sconcat :: NonEmpty (Set a) -> Set a #

stimes :: Integral b => b -> Set a -> Set a #

(Ord a, Enum a) => Monoid (Set a) Source # 
Instance details

Defined in Data.Diet.Set.Lifted

Methods

mempty :: Set a #

mappend :: Set a -> Set a -> Set a #

mconcat :: [Set a] -> Set a #

type Item (Set a) Source # 
Instance details

Defined in Data.Diet.Set.Lifted

type Item (Set a) = (a, a)

singleton Source #

Arguments

:: Ord a 
=> a

inclusive lower bound

-> a

inclusive upper bound

-> Set a 

O(1) Create a diet set with a single element.

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

O(log n) Returns True if the element is a member of the diet set.

difference Source #

Arguments

:: (Ord a, Enum a) 
=> Set a

minuend

-> Set a

subtrahend

-> Set a 

O(n + m*log n) Subtract the subtrahend of size m from the minuend of size n. It should be possible to improve the improve the performance of this to O(n + m). Anyone interested in doing this should open a PR.

intersection Source #

Arguments

:: (Ord a, Enum a) 
=> Set a

minuend

-> Set a

subtrahend

-> Set a 

The intersection of two diet sets.

negate :: (Ord a, Enum a, Bounded a) => Set a -> Set a Source #

The negation of a diet set. The resulting set contains all elements that were not contained by the argument set, and it only contains these elements.

Split

aboveInclusive Source #

Arguments

:: Ord a 
=> a

inclusive lower bound

-> Set a 
-> Set a 

O(n) The subset where all elements are greater than or equal to the given value.

belowInclusive Source #

Arguments

:: Ord a 
=> a

inclusive upper bound

-> Set a 
-> Set a 

O(n) The subset where all elements are less than or equal to the given value.

betweenInclusive Source #

Arguments

:: Ord a 
=> a

inclusive lower bound

-> a

inclusive upper bound

-> Set a 
-> Set a 

O(n) The subset where all elements are greater than or equal to the lower bound and less than or equal to the upper bound.

Folds

foldr :: (a -> a -> b -> b) -> b -> Set a -> b Source #

List Conversion

fromList :: (Ord a, Enum a) => [(a, a)] -> Set a Source #

fromListN Source #

Arguments

:: (Ord a, Enum a) 
=> Int

expected size of resulting diet Set

-> [(a, a)]

key-value pairs

-> Set a