Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.Objects.BitArray
Description
Space efficient bit arrays
The module is meant to be imported qualified (as it is common with collection libraries).
Synopsis
- data BitArray
- size :: BitArray -> Int
- empty :: BitArray
- zeroes :: Int -> BitArray
- count0 :: BitArray -> Int
- count1 :: BitArray -> Int
- foldr :: (Bool -> Int -> a -> a) -> a -> BitArray -> a
- (!) :: BitArray -> Int -> Bool
- setAt :: (MonadError e m, Error e) => Int -> Bool -> BitArray -> m BitArray
- (-&-) :: BitArray -> BitArray -> BitArray
- (-|-) :: BitArray -> BitArray -> BitArray
- subset :: BitArray -> BitArray -> Bool
- asString :: Char -> Char -> BitArray -> String
- fromList :: [Bool] -> BitArray
- toList :: BitArray -> [Bool]
Documentation
A fixed-size, space-efficient array of bits.
foldr :: (Bool -> Int -> a -> a) -> a -> BitArray -> a #
Right fold over the set, including indexes of each value.
(!) :: BitArray -> Int -> Bool infixl 9 #
Test a given bit in an array.
If it's outside its scope, it's always False
.
setAt :: (MonadError e m, Error e) => Int -> Bool -> BitArray -> m BitArray #
Sets or removes an element from a bit array.
Sets a given bit in an array. Fails if the index is out of bounds.
(-&-) :: BitArray -> BitArray -> BitArray infixl 7 #
An intersection of two bit arrays. The length of the result is the minimum length of the two.
(-|-) :: BitArray -> BitArray -> BitArray infixl 5 #
A union of two bit arrays. The length of the result is the maximum length of the two.