Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Data.BloomFilter.Classic.BitArray
Description
Minimal bit array implementation.
Synopsis
- newtype BitArray = BitArray (PrimArray Word64)
- unsafeIndex :: BitArray -> Int -> Bool
- prefetchIndex :: BitArray -> Int -> ST s ()
- newtype MBitArray s = MBitArray (MutablePrimArray s Word64)
- new :: Int -> ST s (MBitArray s)
- unsafeSet :: MBitArray s -> Int -> ST s ()
- unsafeRead :: MBitArray s -> Int -> ST s Bool
- freeze :: MBitArray s -> ST s BitArray
- unsafeFreeze :: MBitArray s -> ST s BitArray
- thaw :: BitArray -> ST s (MBitArray s)
- serialise :: BitArray -> (ByteArray, Int, Int)
- deserialise :: PrimMonad m => MBitArray (PrimState m) -> (MutableByteArray (PrimState m) -> Int -> Int -> m ()) -> m ()
Documentation
Bit vector backed up by an array of Word64
This vector's offset and length are multiples of 64
new :: Int -> ST s (MBitArray s) Source #
Will create an explicitly pinned byte array.
This is done because pinned byte arrays allow for more efficient
serialisation, but the definition of isByteArrayPinned
changed in GHC 9.6,
see https://gitlab.haskell.org/ghc/ghc/-/issues/22255.
TODO: remove this workaround once a solution exists, e.g. a new primop that allows checking for implicit pinning.
deserialise :: PrimMonad m => MBitArray (PrimState m) -> (MutableByteArray (PrimState m) -> Int -> Int -> m ()) -> m () Source #
Do an inplace overwrite of the byte array representing the bit block.