Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Set a = Set (Set Array a)
- singleton :: Ord a => a -> a -> Set a
- member :: Ord a => a -> Set a -> Bool
- difference :: (Ord a, Enum a) => Set a -> Set a -> Set a
- intersection :: (Ord a, Enum a) => Set a -> Set a -> Set a
- negate :: (Ord a, Enum a, Bounded a) => Set a -> Set a
- aboveInclusive :: Ord a => a -> Set a -> Set a
- belowInclusive :: Ord a => a -> Set a -> Set a
- betweenInclusive :: Ord a => a -> a -> Set a -> Set a
- foldr :: (a -> a -> b -> b) -> b -> Set a -> b
- fromList :: (Ord a, Enum a) => [(a, a)] -> Set a
- fromListN :: (Ord a, Enum a) => Int -> [(a, a)] -> Set a
Documentation
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.
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.
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, 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.