byteset-0.1.1.0: Set of bytes.

Safe HaskellSafe
LanguageHaskell2010

Data.ByteSet

Contents

Description

Inspired in the Data.IntSet API, a similar API where the elements of the set are bytes (values of type Word8).

Synopsis

Types

data ByteSet #

Set of bytes (Word8). Note that NF and WHNF are equivalent for values of type ByteSet.

data Word8 :: * #

8-bit unsigned integer type

Instances

Bounded Word8 
Enum Word8 
Eq Word8 

Methods

(==) :: Word8 -> Word8 -> Bool #

(/=) :: Word8 -> Word8 -> Bool #

Integral Word8 
Num Word8 
Ord Word8 

Methods

compare :: Word8 -> Word8 -> Ordering #

(<) :: Word8 -> Word8 -> Bool #

(<=) :: Word8 -> Word8 -> Bool #

(>) :: Word8 -> Word8 -> Bool #

(>=) :: Word8 -> Word8 -> Bool #

max :: Word8 -> Word8 -> Word8 #

min :: Word8 -> Word8 -> Word8 #

Read Word8 
Real Word8 

Methods

toRational :: Word8 -> Rational #

Show Word8 

Methods

showsPrec :: Int -> Word8 -> ShowS #

show :: Word8 -> String #

showList :: [Word8] -> ShowS #

Ix Word8 
Bits Word8 
FiniteBits Word8 
Binary Word8 

Methods

put :: Word8 -> Put #

get :: Get Word8 #

putList :: [Word8] -> Put #

Query

null :: ByteSet -> Bool #

O(1). Is the byteset empty?

size :: ByteSet -> Int #

O(1). Cardinality of the byteset.

member :: Word8 -> ByteSet -> Bool #

O(1). Is the value a member of the byteset?

notMember :: Word8 -> ByteSet -> Bool #

O(1). Is the element not in the set?

Construction

empty :: ByteSet #

O(1). The empty byteset.

singleton :: Word8 -> ByteSet #

O(1). A byteset of one element.

insert :: Word8 -> ByteSet -> ByteSet #

O(1). Add a value to the byteset.

delete :: Word8 -> ByteSet -> ByteSet #

O(1). Delete a byte in the byteset. Returns the original byteset when the byte was not present.

Combine

union :: ByteSet -> ByteSet -> ByteSet #

O(1). The union of two bytesets.

unions :: [ByteSet] -> ByteSet #

The union of a list of bytesets. Just a fold over the list using union.

difference :: ByteSet -> ByteSet -> ByteSet #

O(1). Difference between two bytesets.

intersection :: ByteSet -> ByteSet -> ByteSet #

O(1). The intersection of two bytesets.

Filter

filter :: (Word8 -> Bool) -> ByteSet -> ByteSet #

O(n). Filter all elements that satisfy some predicate.

Map

map :: (Word8 -> Word8) -> ByteSet -> ByteSet #

O(n). Map a function over a byteset.

Folds

foldr :: (Word8 -> a -> a) -> a -> ByteSet -> a #

O(n). Fold the elements in the byteset using the given right-associative binary operator.

List conversion

elems :: ByteSet -> [Word8] #

O(n). The elements of a byteset in ascending order.

toList :: ByteSet -> [Word8] #

O(n). An alias of elems.

fromList :: [Word8] -> ByteSet #

O(n). Create a byteset from a list of bytes.