diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 83a3baa..8ffc3f9 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20240402 +# version: 0.19.20240501 # -# REGENDATA ("0.19.20240402",["github","integer-logarithms.cabal"]) +# REGENDATA ("0.19.20240501",["github","integer-logarithms.cabal"]) # name: Haskell-CI on: @@ -27,19 +27,14 @@ jobs: timeout-minutes: 60 container: - image: buildpack-deps:bionic + image: buildpack-deps:jammy continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - compiler: ghcjs-8.4 - compilerKind: ghcjs - compilerVersion: "8.4" - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-9.10.0.20240328 + - compiler: ghc-9.10.0.20240426 compilerKind: ghc - compilerVersion: 9.10.0.20240328 + compilerVersion: 9.10.0.20240426 setup-method: ghcup allow-failure: false - compiler: ghc-9.8.2 @@ -70,102 +65,30 @@ jobs: - compiler: ghc-8.10.4 compilerKind: ghc compilerVersion: 8.10.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.8.4 compilerKind: ghc compilerVersion: 8.8.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.6.4 - compilerKind: ghc - compilerVersion: 8.6.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.4.4 - compilerKind: ghc - compilerVersion: 8.4.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.2.2 - compilerKind: ghc - compilerVersion: 8.2.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.0.2 - compilerKind: ghc - compilerVersion: 8.0.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.10.3 - compilerKind: ghc - compilerVersion: 7.10.3 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.8.4 - compilerKind: ghc - compilerVersion: 7.8.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.6.3 - compilerKind: ghc - compilerVersion: 7.6.3 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.4.2 - compilerKind: ghc - compilerVersion: 7.4.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.2.2 - compilerKind: ghc - compilerVersion: 7.2.2 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - - compiler: ghc-7.0.4 + - compiler: ghc-8.6.5 compilerKind: ghc - compilerVersion: 7.0.4 - setup-method: hvr-ppa + compilerVersion: 8.6.5 + setup-method: ghcup allow-failure: false fail-fast: false steps: - - name: Set GHCJS environment variables - run: | - if [ $HCKIND = ghcjs ]; then - echo "GHCJS=true" >> "$GITHUB_ENV" - echo "GHCJSARITH=1" >> "$GITHUB_ENV" - else - echo "GHCJS=false" >> "$GITHUB_ENV" - echo "GHCJSARITH=0" >> "$GITHUB_ENV" - fi - env: - HCKIND: ${{ matrix.compilerKind }} - HCNAME: ${{ matrix.compiler }} - HCVER: ${{ matrix.compilerVersion }} - name: apt run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 - if [ "${{ matrix.setup-method }}" = ghcup ]; then - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - else - apt-add-repository -y 'ppa:hvr/ghc' - if [ $((GHCJSARITH)) -ne 0 ] ; then apt-add-repository -y 'ppa:hvr/ghcjs' ; fi - if [ $((GHCJSARITH)) -ne 0 ] ; then curl -sSL "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" | apt-key add - ; fi - if [ $((GHCJSARITH)) -ne 0 ] ; then apt-add-repository -y 'deb https://deb.nodesource.com/node_10.x bionic main' ; fi - apt-get update - if [ $((GHCJSARITH)) -ne 0 ] ; then apt-get install -y "$HCNAME" ghc-8.4.4 nodejs ; else apt-get install -y "$HCNAME" ; fi - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -173,33 +96,24 @@ jobs: - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH - if [ $((GHCJSARITH)) -ne 0 ] ; then echo "/opt/ghc/8.4.4/bin" >> $GITHUB_PATH ; fi echo "LANG=C.UTF-8" >> "$GITHUB_ENV" echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - if [ "${{ matrix.setup-method }}" = ghcup ]; then - 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" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - else - HC=$HCDIR/bin/$HCKIND - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" - echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - fi - + 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" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$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" - if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 70400)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" ; else echo "ARG_TESTS=--disable-tests" >> "$GITHUB_ENV" ; fi + 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" + echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -236,8 +150,6 @@ jobs: $HC --version || true $HC --print-project-git-commit-id || true $CABAL --version || true - if [ $((GHCJSARITH)) -ne 0 ] ; then node --version ; fi - if [ $((GHCJSARITH)) -ne 0 ] ; then echo $GHCJS ; fi - name: update cabal index run: | $CABAL v2-update -v @@ -251,7 +163,7 @@ jobs: chmod a+x $HOME/.cabal/bin/cabal-plan cabal-plan --version - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: source - name: initial cabal.project for sdist @@ -275,8 +187,8 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_integer_logarithms}" >> cabal.project - if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo "package integer-logarithms" >> cabal.project ; fi - if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "package integer-logarithms" >> cabal.project + echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local @@ -287,7 +199,7 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - name: restore cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -304,14 +216,14 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - name: tests run: | - if [ $((! GHCJSARITH && HCNUMVER >= 70400)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct ; fi + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - name: cabal check run: | cd ${PKGDIR_integer_logarithms} || false ${CABAL} -vnormal check - name: haddock run: | - if [ $((! GHCJSARITH)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi + $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 @@ -326,7 +238,7 @@ jobs: $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='integer-logarithms +check-bounds' --dependencies-only -j2 all $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='integer-logarithms +check-bounds' all - name: save cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: always() with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} diff --git a/changelog.md b/changelog.md index 4d3fb42..72029d9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +1.0.4 +----- + +- Drop support for GHCs prior 8.6.5 + 1.0.3.1 ------- diff --git a/integer-logarithms.cabal b/integer-logarithms.cabal index f22a1f7..5f11732 100644 --- a/integer-logarithms.cabal +++ b/integer-logarithms.cabal @@ -1,6 +1,5 @@ name: integer-logarithms -version: 1.0.3.1 -x-revision: 6 +version: 1.0.4 cabal-version: >=1.10 author: Daniel Fischer copyright: @@ -24,16 +23,7 @@ description: category: Math, Algorithms, Number Theory tested-with: - GHC ==7.0.4 - || ==7.2.2 - || ==7.4.2 - || ==7.6.3 - || ==7.8.4 - || ==7.10.3 - || ==8.0.2 - || ==8.2.2 - || ==8.4.4 - || ==8.6.4 + GHC ==8.6.5 || ==8.8.4 || ==8.10.4 || ==9.0.2 @@ -42,7 +32,6 @@ tested-with: || ==9.6.4 || ==9.8.2 || ==9.10.1 - , GHCJS ==8.4 extra-source-files: changelog.md @@ -62,8 +51,8 @@ library default-language: Haskell2010 hs-source-dirs: src build-depends: - array >=0.3 && <0.6 - , base >=4.3 && <4.21 + array >=0.5.3.0 && <0.6 + , base >=4.12.0.0 && <4.21 , ghc-prim <0.12 if !impl(ghc >=7.10) @@ -125,14 +114,11 @@ test-suite spec , integer-logarithms , QuickCheck >=2.14.1 && <2.15 , smallcheck >=1.2 && <1.3 - , tasty >=0.10 && <1.6 - , tasty-hunit >=0.9 && <0.11 - , tasty-quickcheck >=0.8 && <0.11 + , tasty >=1.4 && <1.6 + , tasty-hunit >=0.10 && <0.11 + , tasty-quickcheck >=0.10 && <0.11 , tasty-smallcheck >=0.8 && <0.9 - if !impl(ghc >=7.10) - build-depends: nats ==1.1.* - other-modules: Math.NumberTheory.LogarithmsTests Math.NumberTheory.TestUtils diff --git a/src/Math/NumberTheory/Logarithms.hs b/src/Math/NumberTheory/Logarithms.hs index 9a21668..3729484 100644 --- a/src/Math/NumberTheory/Logarithms.hs +++ b/src/Math/NumberTheory/Logarithms.hs @@ -11,9 +11,7 @@ -- {-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Math.NumberTheory.Logarithms ( -- * Integer logarithms with input checks integerLogBase @@ -330,9 +328,3 @@ naturalLog2# (NatJ# n) = integerLog2# (Jp# n) naturalLog2# n = integerLog2# (toInteger n) #endif #endif - -#if __GLASGOW_HASKELL__ < 707 --- The times they are a-changing. The types of primops too :( -isTrue# :: Bool -> Bool -isTrue# = id -#endif diff --git a/src/Math/NumberTheory/Powers/Integer.hs b/src/Math/NumberTheory/Powers/Integer.hs index 508456c..aad3c60 100644 --- a/src/Math/NumberTheory/Powers/Integer.hs +++ b/src/Math/NumberTheory/Powers/Integer.hs @@ -9,24 +9,13 @@ -- Potentially faster power function for 'Integer' base and 'Int' -- or 'Word' exponent. -- -{-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 -#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-} -#else -{-# LANGUAGE Trustworthy #-} -#endif -#endif module Math.NumberTheory.Powers.Integer {-# DEPRECATED "It is no faster than (^)" #-} ( integerPower , integerWordPower ) where -#if !MIN_VERSION_base(4,8,0) -import Data.Word -#endif - -- | Power of an 'Integer' by the left-to-right repeated squaring algorithm. -- This needs two multiplications in each step while the right-to-left -- algorithm needs only one multiplication for 0-bits, but here the diff --git a/src/Math/NumberTheory/Powers/Natural.hs b/src/Math/NumberTheory/Powers/Natural.hs index 79d312a..f331b8f 100644 --- a/src/Math/NumberTheory/Powers/Natural.hs +++ b/src/Math/NumberTheory/Powers/Natural.hs @@ -9,25 +9,14 @@ -- Potentially faster power function for 'Natural' base and 'Int' -- or 'Word' exponent. -- -{-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 -#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-} -#else -{-# LANGUAGE Trustworthy #-} -#endif -#endif module Math.NumberTheory.Powers.Natural {-# DEPRECATED "It is no faster than (^)" #-} ( naturalPower , naturalWordPower ) where -#if !MIN_VERSION_base(4,8,0) -import Data.Word -#endif - -import Numeric.Natural +import Numeric.Natural (Natural) -- | Power of an 'Natural' by the left-to-right repeated squaring algorithm. -- This needs two multiplications in each step while the right-to-left diff --git a/test-suite/Math/NumberTheory/LogarithmsTests.hs b/test-suite/Math/NumberTheory/LogarithmsTests.hs index 673e8b5..1d99717 100644 --- a/test-suite/Math/NumberTheory/LogarithmsTests.hs +++ b/test-suite/Math/NumberTheory/LogarithmsTests.hs @@ -8,8 +8,6 @@ -- Tests for Math.NumberTheory.Logarithms -- -{-# LANGUAGE CPP #-} - {-# OPTIONS_GHC -fno-warn-type-defaults #-} module Math.NumberTheory.LogarithmsTests @@ -17,11 +15,6 @@ module Math.NumberTheory.LogarithmsTests ) where import Test.Tasty - -#if MIN_VERSION_base(4,8,0) -#else -import Data.Word -#endif import Numeric.Natural import Math.NumberTheory.Logarithms