From f5dae3d984de91a78a6de6ef97d798a033094aad Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sat, 28 Jan 2023 20:31:01 +0200 Subject: [PATCH] Prepare 2.2: GHC-9.6 support, relax upper bounds, tighten lower bounds --- .github/workflows/haskell-ci.yml | 39 ++++++++++++++++++++-------- CHANGELOG.md | 5 ++++ lattices.cabal | 13 ++++++---- src/Algebra/Heyting.hs | 18 ++++++++----- src/Algebra/Lattice.hs | 44 +++++++++++++++++--------------- 5 files changed, 76 insertions(+), 43 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 549c7b9..e84843d 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.15.20221225 +# version: 0.15.20230313 # -# REGENDATA ("0.15.20221225",["github","--config=cabal.haskell-ci","lattices.cabal"]) +# REGENDATA ("0.15.20230313",["github","--config=cabal.haskell-ci","lattices.cabal"]) # name: Haskell-CI on: @@ -32,6 +32,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.6.1 + compilerKind: ghc + compilerVersion: 9.6.1 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.4.4 compilerKind: ghc compilerVersion: 9.4.4 @@ -103,7 +108,7 @@ jobs: curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else apt-add-repository -y 'ppa:hvr/ghc' apt-get update @@ -111,7 +116,7 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -129,13 +134,13 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.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.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" fi HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') @@ -185,7 +190,7 @@ jobs: run: | $CABAL v2-update -v - name: cache (tools) - uses: actions/cache@v2 + uses: actions/cache/restore@v3 with: key: ${{ runner.os }}-${{ matrix.compiler }}-tools-4095ff06 path: ~/.haskell-ci-tools @@ -211,8 +216,14 @@ jobs: run: | if [ $((HCNUMVER >= 80000 && HCNUMVER < 90000)) -ne 0 ] ; then $CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.20' ; fi if [ $((HCNUMVER >= 80000 && HCNUMVER < 90000)) -ne 0 ] ; then doctest --version ; fi + - name: save cache (tools) + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-4095ff06 + path: ~/.haskell-ci-tools - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: source - name: initial cabal.project for sdist @@ -247,8 +258,8 @@ jobs: run: | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - - name: cache - uses: actions/cache@v2 + - name: restore cache + uses: actions/cache/restore@v3 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -280,7 +291,7 @@ jobs: ${CABAL} -vnormal check - name: haddock run: | - $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + $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 @@ -292,3 +303,9 @@ jobs: run: | if [ $((HCNUMVER >= 80800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='transformers ^>=0.6' --dependencies-only -j2 all ; fi if [ $((HCNUMVER >= 80800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='transformers ^>=0.6' all ; fi + - name: save cache + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/CHANGELOG.md b/CHANGELOG.md index cd32937..9a0d0ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.2 (2022-03-15) + +- Drop `semigroupoids` dependency in favour of `foldable1-classes-compat`. + Be careful with which `Foldable1` class you end up using. + # 2.1 (2022-12-27) - Fix `comprable` for `PartialOrd (a,b)` instance diff --git a/lattices.cabal b/lattices.cabal index 5c60031..8314c81 100644 --- a/lattices.cabal +++ b/lattices.cabal @@ -1,6 +1,6 @@ cabal-version: 1.18 name: lattices -version: 2.1 +version: 2.2 category: Math license: BSD3 license-file: LICENSE @@ -34,6 +34,7 @@ tested-with: || ==9.0.2 || ==9.2.5 || ==9.4.4 + || ==9.6.1 synopsis: Fine-grained library for constructing and manipulating lattices @@ -82,25 +83,27 @@ library Algebra.PartialOrd.Instances build-depends: - base >=4.6 && <4.18 - , base-compat >=0.10.5 && <0.13 + base >=4.6 && <4.19 + , base-compat >=0.13 && <0.14 , containers >=0.5.0.0 && <0.7 , deepseq >=1.3.0.0 && <1.5 , hashable >=1.2.7.0 && <1.5 , integer-logarithms >=1.0.3 && <1.1 , QuickCheck >=2.12.6.1 && <2.15 - , semigroupoids >=5.3.2 && <5.4 , tagged >=0.8.6 && <0.9 , transformers >=0.3.0.0 && <0.7 , universe-base >=1.1 && <1.2 , universe-reverse-instances >=1.1 && <1.2 , unordered-containers >=0.2.8.0 && <0.3 + if !impl(ghc >=9.6) + build-depends: foldable1-classes-compat >=0.1 && <0.2 + if !impl(ghc >=9.2) if impl(ghc >=9.0) build-depends: ghc-prim else - build-depends: OneTuple >=0.3 && <0.4 + build-depends: OneTuple >=0.4 && <0.5 if !impl(ghc >=8.0) build-depends: semigroups >=0.18.5 && <0.21 diff --git a/src/Algebra/Heyting.hs b/src/Algebra/Heyting.hs index 42f7ccc..afb507f 100644 --- a/src/Algebra/Heyting.hs +++ b/src/Algebra/Heyting.hs @@ -27,12 +27,16 @@ import Data.Universe.Class (Finite (..)) import qualified Data.HashSet as HS import qualified Data.Set as Set -#if MIN_VERSION_base(4,16,0) -import Data.Tuple (Solo (..)) +#if MIN_VERSION_base(4,18,0) +import Data.Tuple (Solo (MkSolo)) +#elif MIN_VERSION_base(4,16,0) +import Data.Tuple (Solo (Solo)) +#define MkSolo Solo #elif MIN_VERSION_base(4,15,0) -import GHC.Tuple (Solo (..)) +import GHC.Tuple (Solo (Solo)) +#define MkSolo Solo #else -import Data.Tuple.Solo (Solo (..)) +import Data.Tuple.Solo (Solo (MkSolo)) #endif -- | A Heyting algebra is a bounded lattice equipped with a @@ -135,9 +139,9 @@ instance Heyting a => Heyting (Const a b) where -- | @since 2.0.3 instance Heyting a => Heyting (Solo a) where - Solo a ==> Solo b = Solo (a ==> b) - neg (Solo a) = Solo (neg a) - Solo a <=> Solo b = Solo (a <=> b) + MkSolo a ==> MkSolo b = MkSolo (a ==> b) + neg (MkSolo a) = MkSolo (neg a) + MkSolo a <=> MkSolo b = MkSolo (a <=> b) ------------------------------------------------------------------------------- -- Sets diff --git a/src/Algebra/Lattice.hs b/src/Algebra/Lattice.hs index 0bf72e3..4fe8f2f 100644 --- a/src/Algebra/Lattice.hs +++ b/src/Algebra/Lattice.hs @@ -45,18 +45,18 @@ import Prelude.Compat import qualified Algebra.PartialOrd as PO -import Control.Applicative (Const (..)) -import Control.Monad.Zip (MonadZip (..)) -import Data.Data (Data, Typeable) -import Data.Functor.Identity (Identity (..)) -import Data.Hashable (Hashable (..)) -import Data.Proxy (Proxy (..)) -import Data.Semigroup (All (..), Any (..), Endo (..), Semigroup (..)) -import Data.Semigroup.Foldable (Foldable1 (..)) -import Data.Tagged (Tagged (..)) -import Data.Universe.Class (Finite (..), Universe (..)) -import Data.Void (Void) -import GHC.Generics (Generic) +import Control.Applicative (Const (..)) +import Control.Monad.Zip (MonadZip (..)) +import Data.Data (Data, Typeable) +import Data.Foldable1 (Foldable1 (..)) +import Data.Functor.Identity (Identity (..)) +import Data.Hashable (Hashable (..)) +import Data.Proxy (Proxy (..)) +import Data.Semigroup (All (..), Any (..), Endo (..), Semigroup (..)) +import Data.Tagged (Tagged (..)) +import Data.Universe.Class (Finite (..), Universe (..)) +import Data.Void (Void) +import GHC.Generics (Generic) import qualified Data.HashMap.Lazy as HM import qualified Data.HashSet as HS @@ -66,12 +66,16 @@ import qualified Data.Map as Map import qualified Data.Set as Set import qualified Test.QuickCheck as QC -#if MIN_VERSION_base(4,16,0) -import Data.Tuple (Solo (..)) +#if MIN_VERSION_base(4,18,0) +import Data.Tuple (Solo (MkSolo)) +#elif MIN_VERSION_base(4,16,0) +import Data.Tuple (Solo (Solo)) +#define MkSolo Solo #elif MIN_VERSION_base(4,15,0) -import GHC.Tuple (Solo (..)) +import GHC.Tuple (Solo (Solo)) +#define MkSolo Solo #else -import Data.Tuple.Solo (Solo (..)) +import Data.Tuple.Solo (Solo (MkSolo)) #endif infixr 6 /\ -- This comment needed because of CPP @@ -529,16 +533,16 @@ instance BoundedMeetSemiLattice QC.Property where top = QC.property True -- | @since 2.0.3 instance Lattice a => Lattice (Solo a) where - Solo a \/ Solo b = Solo (a \/ b) - Solo a /\ Solo b = Solo (a /\ b) + MkSolo a \/ MkSolo b = MkSolo (a \/ b) + MkSolo a /\ MkSolo b = MkSolo (a /\ b) -- | @since 2.0.3 instance BoundedMeetSemiLattice a => BoundedMeetSemiLattice (Solo a) where - top = Solo top + top = MkSolo top -- | @since 2.0.3 instance BoundedJoinSemiLattice a => BoundedJoinSemiLattice (Solo a) where - bottom = Solo bottom + bottom = MkSolo bottom ------------------------------------------------------------------------------- -- Theorems