structures-0.2: "Advanced" Data Structures

Safe HaskellNone

Data.Vector.Bloom

Contents

Description

Hierarchical Bloom filters

Synopsis

Documentation

Information

entries :: Bloom -> IntSource

Number of bits set

width :: Bloom -> IntSource

The number of bits in our Bloom filter. Always an integral multiple of 64.

Construction

bloom :: (Foldable f, Hashable a) => Int -> Int -> f a -> BloomSource

bloom k m builds an m-bit wide Bloom filter that uses k hashes.

Modification

modify :: (forall s. MBloom s -> ST s ()) -> Bloom -> BloomSource

Given an action on a mutable Bloom filter, modify this one.

insert :: Hashable a => a -> Bloom -> BloomSource

Insert an element into a Bloom filter.

Testing

elem :: Hashable a => a -> Bloom -> BoolSource

Check if an element is a member of a Bloom filter.

This may return false positives, but never a false negative.

Combining Blooms

union :: Bloom -> Bloom -> BloomSource

Compute the union of two Bloom filters.

intersection :: Bloom -> Bloom -> BloomSource

Compute the intersection of two Bloom filters.

Freezing/Thawing

thaw :: PrimMonad m => Bloom -> m (MBloom (PrimState m))Source

O(m)