cabal-version:   3.4
name:            ac-library-hs

-- PVP summary:  +-+------- breaking API changes
--               | | +----- non-breaking API additions
--               | | | +--- code changes with no API change
version:         1.2.3.0
synopsis:        Data structures and algorithms
description:
  Haskell port of [ac-library](https://github.com/atcoder/ac-library), a library for competitive
  programming on [AtCoder](https://atcoder.jp/).

  - Functions primarily use half-open interval \([l, r)\).
  - The `Extra` module contains additional utilities beyond the original C++ library.

category:        Algorithms, Data Structures
license:         CC0-1.0
license-file:    LICENSE
author:          toyboot4e <toyboot4e@gmail.com>
maintainer:      toyboot4e <toyboot4e@gmail.com>
build-type:      Simple
extra-doc-files:
  CHANGELOG.md
  examples/README.md
  README.md

tested-with:     GHC ==9.8.4

source-repository head
  type:     git
  location: https://github.com/toyboot4e/ac-library-hs.git

common warnings
  ghc-options: -Wall

common dependencies
  build-depends:
    , base               >=4.9     && <4.22
    , bitvec             <1.2
    , bytestring         <0.14
    , primitive          >=0.6.4.0 && <0.10
    , vector             >=0.13.0  && <0.14
    , vector-algorithms  <0.10
    , wide-word          <0.2

  default-language: GHC2021

library
  import:          warnings
  import:          dependencies
  exposed-modules:
    AtCoder.Convolution
    AtCoder.Dsu
    AtCoder.Extra.Bisect
    AtCoder.Extra.DynLazySegTree
    AtCoder.Extra.DynLazySegTree.Persistent
    AtCoder.Extra.DynLazySegTree.Raw
    AtCoder.Extra.DynSegTree
    AtCoder.Extra.DynSegTree.Persistent
    AtCoder.Extra.DynSegTree.Raw
    AtCoder.Extra.DynSparseSegTree
    AtCoder.Extra.DynSparseSegTree.Persistent
    AtCoder.Extra.DynSparseSegTree.Raw
    AtCoder.Extra.Graph
    AtCoder.Extra.HashMap
    AtCoder.Extra.IntervalMap
    AtCoder.Extra.IntMap
    AtCoder.Extra.IntSet
    AtCoder.Extra.KdTree
    AtCoder.Extra.LazyKdTree
    AtCoder.Extra.Math
    AtCoder.Extra.Monoid
    AtCoder.Extra.Monoid.Affine1
    AtCoder.Extra.Monoid.Mat2x2
    AtCoder.Extra.Monoid.RangeAdd
    AtCoder.Extra.Monoid.RangeSet
    AtCoder.Extra.Monoid.RollingHash
    AtCoder.Extra.Monoid.V2
    AtCoder.Extra.MultiSet
    AtCoder.Extra.Pdsu
    AtCoder.Extra.Pool
    AtCoder.Extra.SegTree2d
    AtCoder.Extra.SegTree2d.Dense
    AtCoder.Extra.Semigroup.Matrix
    AtCoder.Extra.Semigroup.Permutation
    AtCoder.Extra.Seq
    AtCoder.Extra.Seq.Map
    AtCoder.Extra.Seq.Raw
    AtCoder.Extra.Tree
    AtCoder.Extra.Tree.Hld
    AtCoder.Extra.Tree.Lct
    AtCoder.Extra.Tree.TreeMonoid
    AtCoder.Extra.Vector
    AtCoder.Extra.WaveletMatrix
    AtCoder.Extra.WaveletMatrix.BitVector
    AtCoder.Extra.WaveletMatrix.Raw
    AtCoder.Extra.WaveletMatrix2d
    AtCoder.FenwickTree
    AtCoder.Internal.Assert
    AtCoder.Internal.Barrett
    AtCoder.Internal.Bit
    AtCoder.Internal.Buffer
    AtCoder.Internal.Convolution
    AtCoder.Internal.Csr
    AtCoder.Internal.GrowVec
    AtCoder.Internal.Math
    AtCoder.Internal.McfCsr
    AtCoder.Internal.MinHeap
    AtCoder.Internal.Queue
    AtCoder.Internal.Scc
    AtCoder.Internal.String
    AtCoder.LazySegTree
    AtCoder.Math
    AtCoder.MaxFlow
    AtCoder.MinCostFlow
    AtCoder.ModInt
    AtCoder.Scc
    AtCoder.SegTree
    AtCoder.String
    AtCoder.TwoSat

  -- other-modules:
  -- other-extensions:
  hs-source-dirs:  src

executable example-lazy-segtree
  import:         warnings
  import:         dependencies
  hs-source-dirs: examples
  main-is:        LazySegTree.hs
  build-depends:  ac-library-hs

test-suite ac-library-hs-test
  import:         warnings
  import:         dependencies
  other-modules:
    Tests.Convolution
    Tests.Dsu
    Tests.Extra.Bisect
    Tests.Extra.DynLazySegTree
    Tests.Extra.DynLazySegTree.Persistent
    Tests.Extra.DynSegTree
    Tests.Extra.DynSegTree.Persistent
    Tests.Extra.DynSparseSegTree
    Tests.Extra.DynSparseSegTree.Persistent
    Tests.Extra.Graph
    Tests.Extra.HashMap
    Tests.Extra.IntervalMap
    Tests.Extra.IntMap
    Tests.Extra.IntSet
    Tests.Extra.KdTree
    Tests.Extra.LazyKdTree
    Tests.Extra.Math
    Tests.Extra.Monoid
    Tests.Extra.MultiSet
    Tests.Extra.SegTree2d
    Tests.Extra.SegTree2d.Dense
    Tests.Extra.Semigroup.Matrix
    Tests.Extra.Semigroup.Permutation
    Tests.Extra.Seq
    Tests.Extra.Seq.Map
    Tests.Extra.WaveletMatrix
    Tests.Extra.WaveletMatrix.BitVector
    Tests.Extra.WaveletMatrix.Raw
    Tests.Extra.WaveletMatrix2d
    Tests.FenwickTree
    Tests.Internal.Bit
    Tests.Internal.Buffer
    Tests.Internal.GrowVec
    Tests.Internal.Math
    Tests.Internal.McfCsr
    Tests.Internal.MinHeap
    Tests.Internal.Queue
    Tests.LazySegTree
    Tests.LazySegTreeStress
    Tests.Math
    Tests.MaxFlow
    Tests.MinCostFlow
    Tests.ModInt
    Tests.Scc
    Tests.SegTree
    Tests.String
    Tests.TwoSat
    Tests.Util
    Util

  type:           exitcode-stdio-1.0
  hs-source-dirs: test
  main-is:        Main.hs
  build-depends:
    , ac-library-hs
    , containers
    , hspec
    , mtl
    , QuickCheck
    , quickcheck-classes
    , random
    , tasty
    , tasty-hspec
    , tasty-hunit
    , tasty-quickcheck
    , tasty-rerun
    , transformers
    , unordered-containers

benchmark ac-library-hs-benchmark
  import:         warnings
  import:         dependencies
  ghc-options:    -O2
  type:           exitcode-stdio-1.0
  main-is:        Main.hs
  hs-source-dirs: benchmarks
  other-modules:
    Bench.AddMod
    Bench.Matrix
    Bench.ModInt
    Bench.PowMod
    BenchLib.AddMod
    BenchLib.Matrix
    BenchLib.ModInt.ModIntNats
    BenchLib.ModInt.Modulus
    BenchLib.MulMod.Barrett64
    BenchLib.MulMod.BarrettWideWord
    BenchLib.MulMod.Montgomery
    BenchLib.PowMod

  build-depends:
    , ac-library-hs
    , base
    , criterion
    , mtl
    , random
    , tagged
    , transformers

test-suite benchlib-test
  import:         warnings
  import:         dependencies
  other-modules:
    BenchLib.AddMod
    BenchLib.ModInt.ModIntNats
    BenchLib.ModInt.Modulus
    BenchLib.MulMod.Barrett64
    BenchLib.MulMod.BarrettWideWord
    BenchLib.MulMod.Montgomery
    BenchLib.PowMod
    Tests.MulMod

  type:           exitcode-stdio-1.0
  hs-source-dirs: benchmarks
  main-is:        TestMain.hs
  build-depends:
    , ac-library-hs
    , hspec
    , mtl
    , QuickCheck
    , random
    , tagged
    , tasty
    , tasty-hunit
    , tasty-quickcheck
    , tasty-rerun

-- , quickcheck-instances