packages feed

bloomfilter-blocked-0.1.0.0: bloomfilter-blocked.cabal

cabal-version:      3.4
name:               bloomfilter-blocked
version:            0.1.0.0
synopsis:           Classic and block-style bloom filters
description:
  @bloomfilter-blocked@ is a Haskell library providing multiple fast and efficient
  implementations of [bloom filters](https://en.wikipedia.org/wiki/Bloom_filter).
  It is a full rewrite of the
  [bloomfilter](https://hackage.haskell.org/package/bloomfilter) package,
  originally authored by Bryan O'Sullivan <bos@serpentine.com>.

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

  * /Classic/ bloom filters, found in the "Data.BloomFilter.Classic" module: a
    default implementation that is faithful to the canonical description of a
    bloom filter data structure.

  * /Blocked/ floom filters, found in the "Data.BloomFilter.Blocked" module: an
    implementation that optimises the memory layout of a classic bloom filter for
    speed (cheaper CPU cache reads), at the cost of a slightly higher FPR for the
    same amount of assigned memory.

license:            Apache-2.0
license-files:
  LICENSE
  NOTICE

author:
  Duncan Coutts, Joris Dral, Matthias Heinzel, Wolfgang Jeltsch, Wen Kokke, and Alex Washburn

maintainer:         duncan@well-typed.com, joris@well-typed.com
copyright:          (c) 2023-2025 Cardano Development Foundation
category:           Data
build-type:         Simple
tested-with:
  GHC ==9.2 || ==9.4 || ==9.6 || ==9.8 || ==9.10 || ==9.12

extra-doc-files:
  CHANGELOG.md
  README.md

extra-source-files:
  xxhash/include/HsXXHash.h
  xxhash/xxHash-0.8.2/xxhash.h

license-files:      xxhash/xxHash-0.8.2/LICENSE-xxHash

source-repository head
  type:     git
  location: https://github.com/IntersectMBO/lsm-tree
  subdir:   bloomfilter-blocked

source-repository this
  type:     git
  location: https://github.com/IntersectMBO/lsm-tree
  subdir:   bloomfilter-blocked
  tag:      bloomfilter-blocked-0.1.0.0

common warnings
  ghc-options:
    -Wall -Wcompat -Wincomplete-uni-patterns
    -Wincomplete-record-updates -Wpartial-fields -Widentities
    -Wredundant-constraints -Wmissing-export-lists
    -Wno-unticked-promoted-constructors -Wunused-packages

  ghc-options: -Werror=missing-deriving-strategies

common language
  default-language:   GHC2021
  default-extensions:
    DeriveAnyClass
    DerivingStrategies
    DerivingVia
    ExplicitNamespaces
    GADTs
    LambdaCase
    RecordWildCards
    RoleAnnotations
    ViewPatterns

library
  import:          language, warnings
  hs-source-dirs:  src
  build-depends:
    , base                        >=4.16  && <4.22
    , bloomfilter-blocked:xxhash
    , bytestring                  ^>=0.11 || ^>=0.12
    , deepseq                     ^>=1.4  || ^>=1.5
    , primitive                   ^>=0.9

  exposed-modules:
    Data.BloomFilter
    Data.BloomFilter.Blocked
    Data.BloomFilter.Classic
    Data.BloomFilter.Hash

  other-modules:
    Data.BloomFilter.Blocked.BitArray
    Data.BloomFilter.Blocked.Calc
    Data.BloomFilter.Blocked.Internal
    Data.BloomFilter.Classic.BitArray
    Data.BloomFilter.Classic.Calc
    Data.BloomFilter.Classic.Internal

  ghc-options:     -O2

test-suite tests
  import:         language, warnings
  type:           exitcode-stdio-1.0
  hs-source-dirs: tests
  main-is:        bloomfilter-tests.hs
  build-depends:
    , base                  <5
    , bloomfilter-blocked
    , bytestring
    , quickcheck-instances
    , tasty
    , tasty-quickcheck

benchmark bench
  import:         language, warnings
  type:           exitcode-stdio-1.0
  hs-source-dirs: bench
  main-is:        bloomfilter-bench.hs
  build-depends:
    , base
    , bloomfilter-blocked
    , criterion
    , random

-- It's not really a test suite, but if we make it an executable then its
-- dependencies will be included for dependency resolution when building the
-- main library. As a test-suite, it's more accurately represented as an
-- internal component.
test-suite fpr-calc
  import:         language, warnings
  type:           exitcode-stdio-1.0
  hs-source-dirs: tests
  main-is:        fpr-calc.hs
  build-depends:
    , base
    , bloomfilter-blocked
    , containers
    , parallel
    , random
    , regression-simple

  ghc-options:    -threaded

-- It's not really a test suite, but if we make it an executable then its
-- dependencies will be included for dependency resolution when building the
-- main library. As a test-suite, it's more accurately represented as an
-- internal component.
test-suite spell
  import:         language, warnings
  type:           exitcode-stdio-1.0
  hs-source-dirs: examples
  main-is:        spell.hs
  build-depends:
    , base
    , bloomfilter-blocked
    , directory

-- this exists due to windows
library xxhash
  import:          language, warnings
  visibility:      private
  include-dirs:    xxhash/xxHash-0.8.2/ xxhash/include/
  includes:
    HsXXHash.h
    xxhash.h

  exposed-modules: XXH3

  if (arch(x86_64) && !os(osx))
    -- Cabal doesn't pass cc-options to "ordinary" Haskell source compilation
    -- https://github.com/haskell/cabal/issues/9801
    ghc-options: -optc=-mavx2 -optc=-O3

  other-modules:   FFI
  hs-source-dirs:  xxhash/src
  build-depends:
    , base        <5
    , bytestring  ^>=0.11 || ^>=0.12
    , primitive   ^>=0.9

test-suite xxhash-tests
  import:         language, warnings
  type:           exitcode-stdio-1.0
  hs-source-dirs: xxhash/tests
  main-is:        xxhash-tests.hs
  build-depends:
    , base                        <5
    , bloomfilter-blocked:xxhash
    , bytestring
    , primitive
    , tasty
    , tasty-hunit
    , tasty-quickcheck