Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Set a = Set (Set PrimArray a)
- singleton :: (Ord a, Prim a) => a -> a -> Set a
- member :: (Ord a, Prim a) => a -> Set a -> Bool
- difference :: (Ord a, Enum a, Prim a) => Set a -> Set a -> Set a
- intersection :: (Ord a, Enum a, Prim a) => Set a -> Set a -> Set a
- negate :: (Ord a, Enum a, Prim a, Bounded a) => Set a -> Set a
- aboveInclusive :: (Ord a, Prim a) => a -> Set a -> Set a
- belowInclusive :: (Ord a, Prim a) => a -> Set a -> Set a
- betweenInclusive :: (Ord a, Prim a) => a -> a -> Set a -> Set a
- foldr :: Prim a => (a -> a -> b -> b) -> b -> Set a -> b
- toList :: Prim a => Set a -> [(a, a)]
- fromList :: (Ord a, Enum a, Prim a) => [(a, a)] -> Set a
- fromListN :: (Ord a, Enum a, Prim a) => Int -> [(a, a)] -> Set a
Documentation
A diet set. Currently, the data constructor for this type is exported. Please do not use it.
Instances
(Ord a, Enum a, Prim a) => IsList (Set a) Source # | |
(Eq a, Prim a) => Eq (Set a) Source # | |
(Ord a, Prim a) => Ord (Set a) Source # | |
(Show a, Prim a) => Show (Set a) Source # | |
(Ord a, Enum a, Prim a) => Semigroup (Set a) Source # | |
(Ord a, Enum a, Prim a) => Monoid (Set a) Source # | |
type Item (Set a) Source # | |
Defined in Data.Diet.Set.Unboxed |
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.
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.
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
O(n) The subset where all elements are greater than or equal to the given value.
O(n) The subset where all elements are less than or equal to the given value.
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.