| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Agda.Utils.ByteArray
Description
Utilities for working with ByteArray and ByteArray#.
Synopsis
- byteArrayOnes# :: Int# -> ByteArray#
- byteArrayIsSubsetOf# :: ByteArray# -> ByteArray# -> Int#
- byteArrayDisjoint# :: ByteArray# -> ByteArray# -> Int#
- byteArrayFoldrBits# :: (Int -> a -> a) -> a -> ByteArray# -> a
- byteArrayFoldlBits# :: (a -> Int -> a) -> a -> ByteArray# -> a
- byteArrayFoldrBitsStrict# :: (Int -> a -> a) -> a -> ByteArray# -> a
- byteArrayFoldlBitsStrict# :: (a -> Int -> a) -> a -> ByteArray# -> a
Constructing byte arrays
byteArrayOnes# :: Int# -> ByteArray# Source #
Construct a ByteArray# consisting of n 1 bits.
Queries
byteArrayIsSubsetOf# :: ByteArray# -> ByteArray# -> Int# Source #
Check that if the set bits of a ByteArray# are a subset
of another ByteArray#.
byteArrayDisjoint# :: ByteArray# -> ByteArray# -> Int# Source #
Check if two ByteArray#s are bitwise disjoint.
Folds
As usual, there is an ambiguity in left/right folds for folding over the bits of a
ByteArray#. We opt to use the convention where we treat the 0th bit as the "head" of
the ByteArray#, so a right fold like byteArrayFoldrBits# f x 0b1011 would give f 0 (f 1 (f 3 x)).
byteArrayFoldrBits# :: (Int -> a -> a) -> a -> ByteArray# -> a Source #
Perform a lazy right fold over the bit indicies of a ByteArray#.
byteArrayFoldlBits# :: (a -> Int -> a) -> a -> ByteArray# -> a Source #
Perform a lazy left fold over the bit indicies of a ByteArray#.
Strict folds
byteArrayFoldrBitsStrict# :: (Int -> a -> a) -> a -> ByteArray# -> a Source #
Perform a strict right fold over the bit indicies of a ByteArray#.
byteArrayFoldlBitsStrict# :: (a -> Int -> a) -> a -> ByteArray# -> a Source #
Perform a strict left fold over the bit indicies of a ByteArray#.