Skip to content

Commit daf3619

Browse files
committed
Release bloomfilter-blocked-0.1.0.0
1 parent aada742 commit daf3619

File tree

9 files changed

+63
-31
lines changed

9 files changed

+63
-31
lines changed

bloomfilter-blocked/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Revision history for bloomfilter-blocked
22

3-
## 0.1.0.0 -- YYYY-mm-dd
3+
## 0.1.0.0 -- 2025-08-06
44

55
* First version. Released on an unsuspecting world.

bloomfilter-blocked/README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# bloomfilter-blocked
22

33
`bloomfilter-blocked` is a Haskell library providing multiple fast and efficient
4-
implementations of [bloom filters][bloom-filter:wiki]. It is a full rewrite of
5-
the [`bloomfilter`][bloomfilter:hackage] package, originally authored by Bryan
6-
O'Sullivan <[email protected]>.
4+
implementations of [bloom filters](https://en.wikipedia.org/wiki/Bloom_filter).
5+
It is a full rewrite of the
6+
[`bloomfilter`](https://hackage.haskell.org/package/bloomfilter) package,
7+
originally authored by Bryan O'Sullivan <[email protected]>.
78

89
A bloom filter is a space-efficient data structure representing a set that can
910
be probablistically queried for set membership. The set membership query returns
1011
no false negatives, but it might return false positives. That is, if an element
1112
was added to a bloom filter, then a subsequent query definitely returns `True`.
1213
If an element was *not* added to a filter, then a subsequent query may still
1314
return `True` if `False` would be the correct answer. The probabiliy of false
14-
positives -- the false positive rate (FPR) -- is configurable, as we will
15-
describe later.
15+
positives -- the false positive rate (FPR) -- is configurable.
1616

1717
The library includes two implementations of bloom filters: classic, and blocked.
1818

@@ -48,8 +48,9 @@ User should take into account the following:
4848

4949
# Differences from the `bloomfilter` package
5050

51-
The library is a full rewrite of the [`bloomfilter`][bloomfilter:hackage]
52-
package, originally authored by Bryan O'Sullivan <[email protected]>. The main
51+
The library is a full rewrite of the
52+
[`bloomfilter`](https://hackage.haskell.org/package/bloomfilter) package,
53+
originally authored by Bryan O'Sullivan <[email protected]>. The main
5354
differences are:
5455

5556
* `bloomfilter-blocked` supports both classic and blocked bloom filters, whereas
@@ -62,14 +63,9 @@ differences are:
6263
over a `Hashable` type class, instead of having a `a -> [Hash]` typed field.
6364
This separation in `bloomfilter-blocked` allows clean (de-)serialisation of
6465
filters as the hashing scheme is static.
65-
* `bloomfilter-blocked` uses [`XXH3`][xxh3] for hashing instead of [Jenkins'
66-
`lookup3`][lookup3:wiki], which `bloomfilter` uses.
66+
* `bloomfilter-blocked` uses [`XXH3`](https://xxhash.com/) for hashing instead
67+
of [Jenkins'
68+
`lookup3`](https://en.wikipedia.org/wiki/Jenkins_hash_function#lookup3), which
69+
`bloomfilter` uses.
6770
* The user can configure hash salts for improved security in
6871
`bloomfilter-blocked`, whereas this is not supported in `bloomfilter`.
69-
70-
<!-- Sources -->
71-
72-
[bloom-filter:wiki]: https://en.wikipedia.org/wiki/Bloom_filter
73-
[bloomfilter:hackage]: https://hackage.haskell.org/package/bloomfilter
74-
[xxh3]: https://xxhash.com/
75-
[lookup3:wiki]: https://en.wikipedia.org/wiki/Jenkins_hash_function#lookup3

bloomfilter-blocked/bloomfilter-blocked.cabal

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@ cabal-version: 3.4
22
name: bloomfilter-blocked
33
version: 0.1.0.0
44
synopsis: Classic and block-style bloom filters
5-
description: Classic and block-style bloom filters.
5+
description:
6+
@bloomfilter-blocked@ is a Haskell library providing multiple fast and efficient
7+
implementations of [bloom filters](https://en.wikipedia.org/wiki/Bloom_filter).
8+
It is a full rewrite of the
9+
[@bloomfilter@](https://hackage.haskell.org/package/bloomfilter) package,
10+
originally authored by Bryan O'Sullivan <[email protected]>.
11+
12+
The library includes two implementations of bloom filters: classic, and blocked.
13+
14+
* /Classic/ bloom filters, found in the "Data.BloomFilter.Classic" module: a
15+
default implementation that is faithful to the canonical description of a
16+
bloom filter data structure.
17+
18+
* /Blocked/ floom filters, found in the "Data.BloomFilter.Blocked" module: an
19+
implementation that optimises the memory layout of a classic bloom filter for
20+
speed (cheaper CPU cache reads), at the cost of a slightly higher FPR for the
21+
same amount of assigned memory.
22+
623
license: Apache-2.0
724
license-files:
825
LICENSE
@@ -111,9 +128,13 @@ benchmark bench
111128
, criterion
112129
, random
113130

114-
executable fpr-calc
131+
-- It's not really a test suite, but if we make it an executable then its
132+
-- dependencies will be included for dependency resolution when building the
133+
-- main library. As a test-suite, it's more accurately represented as an
134+
-- internal component.
135+
test-suite fpr-calc
115136
import: language, warnings
116-
scope: private
137+
type: exitcode-stdio-1.0
117138
hs-source-dirs: tests
118139
main-is: fpr-calc.hs
119140
build-depends:
@@ -126,14 +147,19 @@ executable fpr-calc
126147

127148
ghc-options: -threaded
128149

129-
executable spell
150+
-- It's not really a test suite, but if we make it an executable then its
151+
-- dependencies will be included for dependency resolution when building the
152+
-- main library. As a test-suite, it's more accurately represented as an
153+
-- internal component.
154+
test-suite spell
130155
import: language, warnings
131-
scope: private
156+
type: exitcode-stdio-1.0
132157
hs-source-dirs: examples
133158
main-is: spell.hs
134159
build-depends:
135160
, base
136161
, bloomfilter-blocked
162+
, directory
137163

138164
-- this exists due to windows
139165
library xxhash
@@ -155,7 +181,7 @@ library xxhash
155181
hs-source-dirs: xxhash/src
156182
build-depends:
157183
, base <5
158-
, bytestring
184+
, bytestring ^>=0.11 || ^>=0.12
159185
, primitive ^>=0.9
160186

161187
test-suite xxhash-tests

bloomfilter-blocked/examples/spell.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
{-# LANGUAGE BangPatterns #-}
22
module Main (main) where
33

4-
import Control.Monad (forM_)
4+
import Control.Monad (forM_, unless, when)
5+
import System.Directory
56
import System.Environment (getArgs)
7+
import System.Exit
68

79
import qualified Data.BloomFilter as B
810

911
main :: IO ()
1012
main = do
1113
files <- getArgs
14+
when (null files) $ do
15+
putStrLn "No files to spell"
16+
exitSuccess
17+
putStrLn $ "Spelling files: " ++ show files
18+
hasDictionary <- doesFileExist "/usr/share/dict/words"
19+
unless hasDictionary $ do
20+
putStrLn "No dictionary found"
21+
exitSuccess
1222
dictionary <- readFile "/usr/share/dict/words"
1323
let !bloom = B.fromList (B.policyForFPR 0.01) bSalt (words dictionary)
1424
forM_ files $ \file ->

bloomfilter-blocked/tests/fpr-calc.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import qualified Data.IntSet as IntSet
1111
import Data.List (unfoldr)
1212
import Math.Regression.Simple
1313
import System.Environment (getArgs)
14-
import System.Exit (exitFailure)
14+
import System.Exit (exitSuccess)
1515
import System.IO
1616
import System.Random
1717

@@ -28,7 +28,7 @@ main = do
2828
["Regression"] -> main_regression
2929
_ -> do
3030
putStrLn "Usage: bloomfilter-fpr-calc [Generate|Regression]"
31-
exitFailure
31+
exitSuccess
3232

3333
main_regression :: IO ()
3434
main_regression = do

cabal.project.release

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
index-state:
22
-- Bump this if you need newer packages from Hackage
3-
-- current date: quickcheck-lockstep-0.8.0
4-
, hackage.haskell.org 2025-07-03T13:54:16Z
3+
-- current date: release bloomfilter-blocked-0.1.0.0
4+
, hackage.haskell.org 2025-08-06T00:00:00Z
55

66
packages:
77
.

test-prototypes/Test/ScheduledMergesQLS.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Prelude hiding (lookup)
1919

2020
import ScheduledMerges as LSM
2121

22-
import Test.QuickCheck
22+
import Test.QuickCheck hiding (Some)
2323
import Test.QuickCheck.StateModel hiding (lookUpVar)
2424
import Test.QuickCheck.StateModel.Lockstep hiding (ModelOp)
2525
import qualified Test.QuickCheck.StateModel.Lockstep.Defaults as Lockstep

test/Test/Database/LSMTree/Internal/Readers.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import qualified System.FS.BlockIO.Sim as FsSim
4141
import qualified System.FS.Sim.MockFS as MockFS
4242
import qualified Test.QuickCheck as QC
4343
import Test.Tasty (TestTree, testGroup)
44-
import Test.Tasty.QuickCheck
44+
import Test.Tasty.QuickCheck hiding (Some)
4545
import Test.Util.Orphans ()
4646

4747
import Test.QuickCheck.StateModel

test/Test/Database/LSMTree/StateMachine/DL.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import qualified System.FS.Sim.Stream as Stream
2525
import System.FS.Sim.Stream (Stream)
2626
import Test.Database.LSMTree.StateMachine hiding (tests)
2727
import Test.Database.LSMTree.StateMachine.Op
28-
import Test.QuickCheck as QC hiding (label)
28+
import Test.QuickCheck as QC hiding (Some, label)
2929
import Test.QuickCheck.DynamicLogic
3030
import qualified Test.QuickCheck.Gen as QC
3131
import qualified Test.QuickCheck.Random as QC

0 commit comments

Comments
 (0)