monoids-0.1.32: Monoids, specialized containers and a general map/reduce frameworkSource codeContentsIndex
Data.Ring.Semi.BitSet
Portabilityportable (instances use MPTCs)
Stabilityexperimental
Maintainerekmett@gmail.com
Contents
BitSet
Manipulation
Acessors
Description
Replacement for Data.BitSet extended to handle enumerations where fromEnum can return negative values, support efficient intersection and union and allow complementing of the set with respect to the bounds of the enumeration
Synopsis
module Data.Monoid.Reducer
module Data.Ring.Semi
data BitSet a
empty :: BitSet a
singleton :: Enum a => a -> BitSet a
full :: (Enum a, Bounded a) => BitSet a
union :: BitSet a -> BitSet a -> BitSet a
intersection :: BitSet a -> BitSet a -> BitSet a
complement :: (Enum a, Bounded a) => BitSet a -> BitSet a
insert :: Enum a => a -> BitSet a -> BitSet a
delete :: Enum a => a -> BitSet a -> BitSet a
(\\) :: Enum a => BitSet a -> BitSet a -> BitSet a
fromList :: Enum a => [a] -> BitSet a
fromDistinctAscList :: Enum a => [a] -> BitSet a
member :: Enum a => a -> BitSet a -> Bool
null :: BitSet a -> Bool
size :: BitSet a -> Int
isComplemented :: BitSet a -> Bool
toInteger :: BitSet a -> Integer
Documentation
module Data.Monoid.Reducer
module Data.Ring.Semi
BitSet
data BitSet a Source
show/hide Instances
Manipulation
empty :: BitSet aSource
O(1) The empty set. Permits O(1) null and size.
singleton :: Enum a => a -> BitSet aSource
O(1) Construct a BitSet with a single element. Permits O(1) null and size
full :: (Enum a, Bounded a) => BitSet aSource
O(d) A BitSet containing every member of the enumeration of a.
union :: BitSet a -> BitSet a -> BitSet aSource
O(d). May force size to take O(d) if ranges overlap, preserves order of null
intersection :: BitSet a -> BitSet a -> BitSet aSource
O(d). May force size and null both to take O(d).
complement :: (Enum a, Bounded a) => BitSet a -> BitSet aSource
O(d) Complements a BitSet with respect to the bounds of a. Preserves order of null and size
insert :: Enum a => a -> BitSet a -> BitSet aSource
O(d) Insert a single element of type a into the BitSet. Preserves order of null and size
delete :: Enum a => a -> BitSet a -> BitSet aSource
O(d) Delete a single item from the BitSet. Preserves order of null and size
(\\) :: Enum a => BitSet a -> BitSet a -> BitSet aSource
O(d). Preserves order of null. May force O(d) size.
fromList :: Enum a => [a] -> BitSet aSource
O(d * n) Make a BitSet from a list of items.
fromDistinctAscList :: Enum a => [a] -> BitSet aSource
O(d * n) Make a BitSet from a distinct ascending list of items
Acessors
member :: Enum a => a -> BitSet a -> BoolSource
O(1) Test for membership in a BitSet
null :: BitSet a -> BoolSource
O(1|d) Is the BitSet empty? May be faster than checking if size == 0 after union. Operations that require a recount are noted.
size :: BitSet a -> IntSource
O(1|d) The number of elements in the bit set.
isComplemented :: BitSet a -> BoolSource
O(1) check to see if we are represented as a complemented BitSet.
toInteger :: BitSet a -> IntegerSource
O(d) convert to an Integer representation. Discards negative elements
Produced by Haddock version 2.4.2