Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Inspired in the Data.IntSet
API, a similar API where the elements
of the set are bytes (values of type Word8
).
- data ByteSet
- data Word8 :: *
- null :: ByteSet -> Bool
- size :: ByteSet -> Int
- member :: Word8 -> ByteSet -> Bool
- notMember :: Word8 -> ByteSet -> Bool
- empty :: ByteSet
- singleton :: Word8 -> ByteSet
- insert :: Word8 -> ByteSet -> ByteSet
- delete :: Word8 -> ByteSet -> ByteSet
- union :: ByteSet -> ByteSet -> ByteSet
- unions :: [ByteSet] -> ByteSet
- difference :: ByteSet -> ByteSet -> ByteSet
- intersection :: ByteSet -> ByteSet -> ByteSet
- filter :: (Word8 -> Bool) -> ByteSet -> ByteSet
- map :: (Word8 -> Word8) -> ByteSet -> ByteSet
- foldr :: (Word8 -> a -> a) -> a -> ByteSet -> a
- elems :: ByteSet -> [Word8]
- toList :: ByteSet -> [Word8]
- fromList :: [Word8] -> ByteSet
Types
data Word8 :: *
8-bit unsigned integer type
Query
Construction
delete :: Word8 -> ByteSet -> ByteSet Source
O(1). Delete a byte in the byteset. Returns the original byteset when the byte was not present.
Combine
unions :: [ByteSet] -> ByteSet Source
The union of a list of bytesets. Just a fold over the list using union
.
difference :: ByteSet -> ByteSet -> ByteSet Source
O(1). Difference between two bytesets.
intersection :: ByteSet -> ByteSet -> ByteSet Source
O(1). The intersection of two bytesets.
Filter
filter :: (Word8 -> Bool) -> ByteSet -> ByteSet Source
O(n). Filter all elements that satisfy some predicate.
Map
Folds
foldr :: (Word8 -> a -> a) -> a -> ByteSet -> a Source
O(n). Fold the elements in the byteset using the given right-associative binary operator.