diff --git a/.github/workflows/haskell-ci.yaml b/.github/workflows/haskell-ci.yaml new file mode 100644 index 0000000..b80a38e --- /dev/null +++ b/.github/workflows/haskell-ci.yaml @@ -0,0 +1,29 @@ +name: Haskell CI + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ghc: ['8.0.2', '8.2.2', '8.4.4', '8.6.5', '8.8.4', '8.10.7', '9.0.2', '9.2.8', '9.4.8', '9.6.7', '9.8.4', '9.10.3', '9.12.2'] + steps: + - uses: actions/checkout@v5 + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + - uses: actions/cache@v4 + with: + path: | + ${{ steps.setup-haskell.outputs.cabal-store }} + dist-newstyle + key: ${{ runner.os }}-${{ matrix.ghc }} + - name: Build + run: cabal build + - name: Test + run: cabal test diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml deleted file mode 100644 index 6cfcfbe..0000000 --- a/.github/workflows/haskell-ci.yml +++ /dev/null @@ -1,256 +0,0 @@ -# This GitHub workflow config has been generated by a script via -# -# haskell-ci 'github' 'pqueue.cabal' -# -# To regenerate the script (for example after adjusting tested-with) run -# -# haskell-ci regenerate -# -# For more information, see https://github.com/haskell-CI/haskell-ci -# -# version: 0.19.20250216 -# -# REGENDATA ("0.19.20250216",["github","pqueue.cabal"]) -# -name: Haskell-CI -on: - - push - - pull_request -jobs: - linux: - name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-24.04 - timeout-minutes: - 60 - container: - image: buildpack-deps:jammy - continue-on-error: ${{ matrix.allow-failure }} - strategy: - matrix: - include: - - compiler: ghc-9.12.2 - compilerKind: ghc - compilerVersion: 9.12.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.10.1 - compilerKind: ghc - compilerVersion: 9.10.1 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.8.4 - compilerKind: ghc - compilerVersion: 9.8.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.6.6 - compilerKind: ghc - compilerVersion: 9.6.6 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.4.8 - compilerKind: ghc - compilerVersion: 9.4.8 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.2.8 - compilerKind: ghc - compilerVersion: 9.2.8 - setup-method: ghcup - allow-failure: false - - compiler: ghc-9.0.2 - compilerKind: ghc - compilerVersion: 9.0.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.10.7 - compilerKind: ghc - compilerVersion: 8.10.7 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.8.4 - compilerKind: ghc - compilerVersion: 8.8.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.6.5 - compilerKind: ghc - compilerVersion: 8.6.5 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.4.4 - compilerKind: ghc - compilerVersion: 8.4.4 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.2.2 - compilerKind: ghc - compilerVersion: 8.2.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-8.0.2 - compilerKind: ghc - compilerVersion: 8.0.2 - setup-method: ghcup - allow-failure: false - fail-fast: false - steps: - - name: apt-get install - run: | - apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev - - name: Install GHCup - run: | - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.40.0/x86_64-linux-ghcup-0.1.40.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - - name: Install cabal-install - run: | - "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - - name: Install GHC (GHCup) - if: matrix.setup-method == 'ghcup' - run: | - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - - name: Set PATH and environment variables - run: | - echo "$HOME/.cabal/bin" >> $GITHUB_PATH - echo "LANG=C.UTF-8" >> "$GITHUB_ENV" - echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" - echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" - HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') - echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" - echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" - echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" - echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - - name: env - run: | - env - - name: write cabal config - run: | - mkdir -p $CABAL_DIR - cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz - echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan - rm -f cabal-plan.xz - chmod a+x $HOME/.cabal/bin/cabal-plan - cabal-plan --version - - name: checkout - uses: actions/checkout@v4 - with: - path: source - - name: initial cabal.project for sdist - run: | - touch cabal.project - echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project - cat cabal.project - - name: sdist - run: | - mkdir -p sdist - $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist - - name: unpack - run: | - mkdir -p unpacked - find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; - - name: generate cabal.project - run: | - PKGDIR_pqueue="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/pqueue-[0-9.]*')" - echo "PKGDIR_pqueue=${PKGDIR_pqueue}" >> "$GITHUB_ENV" - rm -f cabal.project cabal.project.local - touch cabal.project - touch cabal.project.local - echo "packages: ${PKGDIR_pqueue}" >> cabal.project - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package pqueue" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - cat >> cabal.project <> cabal.project.local - cat cabal.project - cat cabal.project.local - - name: dump install plan - run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all - cabal-plan - - name: restore cache - uses: actions/cache/restore@v4 - with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} - path: ~/.cabal/store - restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - - name: install dependencies - run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all - - name: build w/o tests - run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: build - run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - - name: tests - run: | - $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - - name: cabal check - run: | - cd ${PKGDIR_pqueue} || false - ${CABAL} -vnormal check - - name: haddock - run: | - $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all - - name: unconstrained build - run: | - rm -f cabal.project.local - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: save cache - if: always() - uses: actions/cache/save@v4 - with: - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} - path: ~/.cabal/store diff --git a/CHANGELOG.md b/CHANGELOG.md index a070bf0..b7063e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,129 +1,137 @@ # Revision history for pqueue -## x.x.x.x +## 1.6.0.0 -- 2025-10-11 - * Deprecate `mapU` and replace it by `mapMonotonic` in `Data.PQeueu.Min` and `Data.PQueue.Max` - ([#129](https://github.com/lspitzner/pqueue/pull/129)) +* Deprecate `mapU` and replace it by `mapMonotonic` in `Data.PQeueu.Min` and `Data.PQueue.Max` + ([#129](https://github.com/lspitzner/pqueue/pull/129)) + +* Add ghc-9.8, ghc-9.10 & ghc-9.12 support + ([#133](https://github.com/lspitzner/pqueue/pull/133), [#135](https://github.com/lspitzner/pqueue/pull/135), [#139](https://github.com/lspitzner/pqueue/pull/139)) + +* Drop ghc-7.10 support ([#142](https://github.com/lspitzner/pqueue/pull/142)) + +* Fix typo in `Data.PQueue.Max.toList` documentation + ([#131](https://github.com/lspitzner/pqueue/pull/131)) ## 1.5.0.0 -- 2023-08-08 - * Fix incorrect behavior of `mapMaybe` and `mapEither` for `MinQueue`. These - previously worked only for monotonic functions. +* Fix incorrect behavior of `mapMaybe` and `mapEither` for `MinQueue`. These + previously worked only for monotonic functions. - * Fix a performance bug that caused queue performance not to improve - when the queue shrinks. - ([#109](https://github.com/lspitzner/pqueue/pull/109)) +* Fix a performance bug that caused queue performance not to improve + when the queue shrinks. + ([#109](https://github.com/lspitzner/pqueue/pull/109)) - * Make `minView` more eager, improving performance in typical cases. - ([#107](https://github.com/lspitzner/pqueue/pull/107)) +* Make `minView` more eager, improving performance in typical cases. + ([#107](https://github.com/lspitzner/pqueue/pull/107)) - * Make mapping and traversal functions force the full data structure spine. - This should make performance more predictable, and removes the last - remaining reasons to use the `seqSpine` functions. As these are no longer - useful, deprecate them. - ([#103](https://github.com/lspitzner/pqueue/pull/103)) +* Make mapping and traversal functions force the full data structure spine. + This should make performance more predictable, and removes the last + remaining reasons to use the `seqSpine` functions. As these are no longer + useful, deprecate them. + ([#103](https://github.com/lspitzner/pqueue/pull/103)) - * Deprecate `insertBehind`. This function does not play nicely with merges, - we lack tests to verify it works properly without merges, it imposes a - substantial maintenance burden on the rest of the package, and it is quite - slow. ([#35](https://github.com/lspitzner/pqueue/issues/35)) +* Deprecate `insertBehind`. This function does not play nicely with merges, + we lack tests to verify it works properly without merges, it imposes a + substantial maintenance burden on the rest of the package, and it is quite + slow. ([#35](https://github.com/lspitzner/pqueue/issues/35)) - * Add pattern synonyms to work with `MinQueue` and `MinPQueue`. - ([#92](https://github.com/lspitzner/pqueue/pull/92)) +* Add pattern synonyms to work with `MinQueue` and `MinPQueue`. + ([#92](https://github.com/lspitzner/pqueue/pull/92)) - * Make the `Data` instances respect the queue invariants. Make the - `Constr`s match the pattern synonyms. Make the `Data` instance for - `MinPQueue` work "incrementally", like the one for `MinQueue`. - ([#92](https://github.com/lspitzner/pqueue/pull/92)) +* Make the `Data` instances respect the queue invariants. Make the + `Constr`s match the pattern synonyms. Make the `Data` instance for + `MinPQueue` work "incrementally", like the one for `MinQueue`. + ([#92](https://github.com/lspitzner/pqueue/pull/92)) ## 1.4.3.0 -- 2022-10-30 - * Add instances for [indexed-traversable](https://hackage.haskell.org/package/indexed-traversable). - ([#85](https://github.com/lspitzner/pqueue/pull/85)) - * Add ghc-9.4 support. ([#86](https://github.com/lspitzner/pqueue/pull/86)) +* Add instances for [indexed-traversable](https://hackage.haskell.org/package/indexed-traversable). + ([#85](https://github.com/lspitzner/pqueue/pull/85)) +* Add ghc-9.4 support. ([#86](https://github.com/lspitzner/pqueue/pull/86)) ## 1.4.2.0 -- 2022-06-19 - * Overall performance has improved greatly, especially when there are many - insertions and/or merges in a row. Insertion, deletion, and merge are now - *worst case* logarithmic, while maintaining their previous amortized - bounds. ([#26](https://github.com/lspitzner/pqueue/pull/26)) +* Overall performance has improved greatly, especially when there are many + insertions and/or merges in a row. Insertion, deletion, and merge are now + *worst case* logarithmic, while maintaining their previous amortized + bounds. ([#26](https://github.com/lspitzner/pqueue/pull/26)) - * New `mapMWithKey` functions optimized for working in strict monads. These - are used to implement the `mapM` and `sequence` methods of `Traversable`. - ([#46](https://github.com/lspitzner/pqueue/pull/46)) +* New `mapMWithKey` functions optimized for working in strict monads. These + are used to implement the `mapM` and `sequence` methods of `Traversable`. + ([#46](https://github.com/lspitzner/pqueue/pull/46)) - * Define `stimes` in the `Semigroup` instances. - ([#57](https://github.com/lspitzner/pqueue/pull/57)) +* Define `stimes` in the `Semigroup` instances. + ([#57](https://github.com/lspitzner/pqueue/pull/57)) - * Add strict left unordered folds (`foldlU'`, `foldlWithKeyU'`) - and monoidal unordered folds (`foldMapU`, `foldMapWithKeyU`). - ([#59](https://github.com/lspitzner/pqueue/pull/59)) +* Add strict left unordered folds (`foldlU'`, `foldlWithKeyU'`) + and monoidal unordered folds (`foldMapU`, `foldMapWithKeyU`). + ([#59](https://github.com/lspitzner/pqueue/pull/59)) - * New functions for adjusting and updating the min/max of a key-value - priority queue in an `Applicative` context. - ([#66](https://github.com/lspitzner/pqueue/pull/66)) +* New functions for adjusting and updating the min/max of a key-value + priority queue in an `Applicative` context. + ([#66](https://github.com/lspitzner/pqueue/pull/66)) - * Fixed `Data.PQueue.Max.map` to work on `MaxQueue`s. - ([#76](https://github.com/lspitzner/pqueue/pull/76)) +* Fixed `Data.PQueue.Max.map` to work on `MaxQueue`s. + ([#76](https://github.com/lspitzner/pqueue/pull/76)) ## 1.4.1.4 -- 2021-12-04 - * Maintenance release for ghc-9.0 & ghc-9.2 support - * Change nix-setup to use the seaaye tool +* Maintenance release for ghc-9.0 & ghc-9.2 support +* Change nix-setup to use the seaaye tool ## 1.4.1.3 -- 2020-06-06 - * Maintenance release - * Add missing documentation - * Add nix-expressions for testing against different compilers/package sets +* Maintenance release +* Add missing documentation +* Add nix-expressions for testing against different compilers/package sets ## 1.4.1.2 -- 2018-09-26 - * Maintenance release for ghc-8.6 - * Drop support for ghc<7.10 +* Maintenance release for ghc-8.6 +* Drop support for ghc<7.10 ## 1.4.1.1 -- 2018-02-11 - * Remove/replace buggy `insertBehind` implementation. +* Remove/replace buggy `insertBehind` implementation. - The existing implementation did not always insert behind. As a fix, - the function was removed from Data.PQueue.Max/Min and was rewritten - with a O(n) complexity (!) for Data.PQueue.Prio.Max/Min. + The existing implementation did not always insert behind. As a fix, + the function was removed from Data.PQueue.Max/Min and was rewritten + with a O(n) complexity (!) for Data.PQueue.Prio.Max/Min. - * Adapt for ghc-8.4, based on the ghc-8.4.1-alpha1 release - * Drop support for ghc<7.4 +* Adapt for ghc-8.4, based on the ghc-8.4.1-alpha1 release +* Drop support for ghc<7.4 ## 1.3.2.3 -- 2017-08-01 - * Maintenance release for ghc-8.2 +* Maintenance release for ghc-8.2 ## 1.3.2.2 -- 2017-03-12 - * Add test-suite from darcs repository for pqueue-1.0.1. +* Add test-suite from darcs repository for pqueue-1.0.1. ## 1.3.2.1 -- 2017-03-11 - * Fix documentation errors - - complexity on `toList`, `toListU` - - `PQueue.Prio.Max` had "ascending" instead of "descending" in some places +* Fix documentation errors + - complexity on `toList`, `toListU` + - `PQueue.Prio.Max` had "ascending" instead of "descending" in some places ## 1.3.2 -- 2016-09-28 - * Add function `insertBehind` as a slight variation of `insert` which differs - in behaviour for elements the compare equal. +* Add function `insertBehind` as a slight variation of `insert` which differs + in behaviour for elements the compare equal. ## 1.3.1.1 -- 2016-05-21 - * Ensure compatibility with ghc-8 - * Minor internal refactors +* Ensure compatibility with ghc-8 +* Minor internal refactors ## 1.3.1 -- 2015-10-03 - * Add `Monoid` instance for `MaxPQueue` +* Add `Monoid` instance for `MaxPQueue` ## 1.3.0 -- 2015-06-23 - * Lennart Spitzner starts co-maintaining - * new git repository at github.com:lspitzner/pqueue - * Ensure compatibility with ghc-7.10 +* Lennart Spitzner starts co-maintaining +* new git repository at github.com:lspitzner/pqueue +* Ensure compatibility with ghc-7.10 diff --git a/pqueue.cabal b/pqueue.cabal index ce41cc3..0996ac6 100644 --- a/pqueue.cabal +++ b/pqueue.cabal @@ -1,5 +1,5 @@ name: pqueue -version: 1.5.0.0 +version: 1.6.0.0 category: Data Structures author: Louis Wasserman license: BSD3 @@ -17,9 +17,9 @@ build-type: Simple cabal-version: >= 1.10 tested-with: GHC == 9.12.2 - GHC == 9.10.1 + GHC == 9.10.3 GHC == 9.8.4 - GHC == 9.6.6 + GHC == 9.6.7 GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 diff --git a/src/Data/PQueue/Max.hs b/src/Data/PQueue/Max.hs index 30c7fec..da3ef4d 100644 --- a/src/Data/PQueue/Max.hs +++ b/src/Data/PQueue/Max.hs @@ -1,5 +1,7 @@ {-# LANGUAGE CPP #-} +{-# OPTIONS_GHC -Wno-deprecations #-} + ----------------------------------------------------------------------------- -- | -- Module : Data.PQueue.Max diff --git a/src/Data/PQueue/Prio/Max/Internals.hs b/src/Data/PQueue/Prio/Max/Internals.hs index 139d5b8..3914645 100644 --- a/src/Data/PQueue/Prio/Max/Internals.hs +++ b/src/Data/PQueue/Prio/Max/Internals.hs @@ -3,6 +3,8 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# OPTIONS_GHC -Wno-deprecations #-} + ----------------------------------------------------------------------------- -- | -- Module : Data.PQueue.Prio.Max diff --git a/tests/PQueueTests.hs b/tests/PQueueTests.hs index b5b13cb..15c3a58 100644 --- a/tests/PQueueTests.hs +++ b/tests/PQueueTests.hs @@ -6,6 +6,8 @@ {-# language TupleSections #-} {-# language ViewPatterns #-} +{-# options_ghc -Wno-x-partial #-} + module Main (main) where import Data.Bifunctor (bimap, first, second)