primitive-containers-0.3.1: containers backed by arrays

Safe HaskellNone
LanguageHaskell2010

Data.Diet.Set.Unboxed

Contents

Synopsis

Documentation

newtype Set a Source #

A diet set. Currently, the data constructor for this type is exported. Please do not use it.

Constructors

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

Defined in Data.Diet.Set.Unboxed

Associated Types

type Item (Set a) :: Type #

Methods

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

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

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

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

Defined in Data.Diet.Set.Unboxed

Methods

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

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

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

Defined in Data.Diet.Set.Unboxed

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, Prim a) => Show (Set a) Source # 
Instance details

Defined in Data.Diet.Set.Unboxed

Methods

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

show :: Set a -> String #

showList :: [Set a] -> ShowS #

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

Defined in Data.Diet.Set.Unboxed

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, Prim a) => Monoid (Set a) Source # 
Instance details

Defined in Data.Diet.Set.Unboxed

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.Unboxed

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

singleton Source #

Arguments

:: (Ord a, Prim a) 
=> a

inclusive lower bound

-> a

inclusive upper bound

-> Set a 

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

member :: (Ord a, Prim a) => a -> Set a -> Bool Source #

O(log n) Lookup the value at a key in the map.

difference Source #

Arguments

:: (Ord a, Enum a, Prim 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, Prim a) 
=> Set a

minuend

-> Set a

subtrahend

-> Set a 

The intersection of two diet sets.

negate :: (Ord a, Enum a, Prim 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, Prim 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, Prim 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, Prim 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 :: Prim a => (a -> a -> b -> b) -> b -> Set a -> b Source #

List Conversion

toList :: Prim a => Set a -> [(a, a)] Source #

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

fromListN Source #

Arguments

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

expected size of resulting diet Set

-> [(a, a)]

key-value pairs

-> Set a