Copyright | (c) 2016 Micxjo Funkcio |
---|---|
License | BSD3 |
Maintainer | micxjo@fastmail.com |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
- data RangeSet a
- empty :: RangeSet a
- singleton :: Enum a => a -> RangeSet a
- rangeSet :: (Ord a, Enum a) => a -> a -> RangeSet a
- insert :: (Enum a, Ord a, Bounded a) => a -> RangeSet a -> RangeSet a
- member :: Ord a => a -> RangeSet a -> Bool
- notMember :: Ord a => a -> RangeSet a -> Bool
- size :: Num a => RangeSet a -> a
- isEmpty :: RangeSet a -> Bool
- isSingleton :: Eq a => RangeSet a -> Bool
- ranges :: RangeSet a -> [Range a]
- union :: (Ord a, Enum a, Bounded a) => RangeSet a -> RangeSet a -> RangeSet a
- unions :: (Ord a, Enum a, Bounded a, Foldable t) => t (RangeSet a) -> RangeSet a
- toList :: Enum a => RangeSet a -> [a]
- toAscList :: Enum a => RangeSet a -> [a]
- toDescList :: Enum a => RangeSet a -> [a]
RangeSet type
A set of elements, represented as a (possibly empty) list of disjoint ranges.
Construction
rangeSet :: (Ord a, Enum a) => a -> a -> RangeSet a Source
Create a set from (min a b) to (max a b), inclusive.
insert :: (Enum a, Ord a, Bounded a) => a -> RangeSet a -> RangeSet a Source
Insert an elemen in the set.
Query
isSingleton :: Eq a => RangeSet a -> Bool Source
Does the set contain exactly one element?
Combine
union :: (Ord a, Enum a, Bounded a) => RangeSet a -> RangeSet a -> RangeSet a Source
The union of two sets.
unions :: (Ord a, Enum a, Bounded a, Foldable t) => t (RangeSet a) -> RangeSet a Source
The union of a list of sets: (union == foldl union empty)
Conversion
toDescList :: Enum a => RangeSet a -> [a] Source
All of the elements of the set, in descending order.