From 4115223f97e3b5f42fc7ac7bb29cf30190cc13e4 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Sat, 9 Sep 2023 23:26:13 +0100 Subject: [PATCH] Drop support of GHC < 8.2 --- .github/workflows/build.yaml | 83 ++++++++++++++-------------- data-interval.cabal | 26 ++------- src/Data/IntegerInterval/Internal.hs | 4 +- src/Data/Interval.hs | 2 - src/Data/Interval/Internal.hs | 9 +-- src/Data/IntervalMap/Base.hs | 20 ------- src/Data/IntervalMap/Strict.hs | 5 +- src/Data/IntervalRelation.hs | 2 +- src/Data/IntervalSet.hs | 16 ------ 9 files changed, 52 insertions(+), 115 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b135c9b..309fedd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20230115 +# version: 0.17.20230826 # -# REGENDATA ("0.15.20230115",["github","data-interval.cabal","--output",".github/workflows/build.yaml"]) +# REGENDATA ("0.17.20230826",["github","data-interval.cabal","--output",".github/workflows/build.yaml"]) # name: Haskell-CI on: @@ -28,19 +28,24 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.6.0.20230111 + - compiler: ghc-9.8.0.20230822 compilerKind: ghc - compilerVersion: 9.6.0.20230111 + compilerVersion: 9.8.0.20230822 setup-method: ghcup allow-failure: true - - compiler: ghc-9.4.4 + - compiler: ghc-9.6.2 compilerKind: ghc - compilerVersion: 9.4.4 + compilerVersion: 9.6.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.5 + - compiler: ghc-9.4.7 compilerKind: ghc - compilerVersion: 9.2.5 + compilerVersion: 9.4.7 + 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 @@ -73,21 +78,6 @@ jobs: 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 fail-fast: false steps: - name: apt @@ -96,19 +86,20 @@ jobs: 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.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$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.7.yaml; "$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 apt-get install -y "$HCNAME" 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" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$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" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -122,24 +113,26 @@ jobs: echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$HOME/.ghcup/bin/$HCKIND-$HCVER + 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=$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 "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$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))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + if [ $((HCNUMVER >= 90800)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -196,14 +189,14 @@ jobs: - name: install cabal-plan run: | mkdir -p $HOME/.cabal/bin - curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz - echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > 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@v2 + uses: actions/checkout@v3 with: path: source - name: initial cabal.project for sdist @@ -227,8 +220,8 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_data_interval}" >> cabal.project - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package data-interval" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "package data-interval" >> cabal.project + echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <=4 && <5 + base >=4.10 && <5 , containers , deepseq , hashable >=1.1.2.5 && <1.5 , extended-reals >=0.2 && <1.0 - if impl(ghc <8.0) - Build-depends: - semigroups if flag(lattices) build-depends: lattices >=1.2.1.1 && <2.3 Default-Language: Haskell2010 Other-Extensions: - CPP ScopedTypeVariables TypeFamilies DeriveDataTypeable @@ -101,15 +95,7 @@ Test-suite test-interval , tasty-th , HUnit , QuickCheck >=2.5 && <3 - if impl(ghc >=8.0) - Build-depends: - quickcheck-classes-base - if impl(ghc <8.0) - Build-depends: - semigroups - if impl(ghc <7.10) - Build-depends: - transformers >=0.2 + , quickcheck-classes-base if flag(lattices) build-depends: lattices diff --git a/src/Data/IntegerInterval/Internal.hs b/src/Data/IntegerInterval/Internal.hs index ecbbc50..be0eb3a 100644 --- a/src/Data/IntegerInterval/Internal.hs +++ b/src/Data/IntegerInterval/Internal.hs @@ -1,9 +1,7 @@ {-# OPTIONS_GHC -Wall #-} -{-# LANGUAGE CPP, DeriveDataTypeable, LambdaCase #-} +{-# LANGUAGE DeriveDataTypeable, LambdaCase #-} {-# LANGUAGE Safe #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif module Data.IntegerInterval.Internal ( IntegerInterval diff --git a/src/Data/Interval.hs b/src/Data/Interval.hs index 38f19c2..6afcd20 100644 --- a/src/Data/Interval.hs +++ b/src/Data/Interval.hs @@ -1,9 +1,7 @@ {-# OPTIONS_GHC -Wall -fno-warn-orphans #-} {-# LANGUAGE CPP, LambdaCase, ScopedTypeVariables #-} {-# LANGUAGE Safe #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Interval diff --git a/src/Data/Interval/Internal.hs b/src/Data/Interval/Internal.hs index 9094ccf..c34876d 100644 --- a/src/Data/Interval/Internal.hs +++ b/src/Data/Interval/Internal.hs @@ -1,9 +1,7 @@ {-# OPTIONS_GHC -Wall #-} -{-# LANGUAGE CPP, DeriveDataTypeable, DeriveGeneric, LambdaCase, ScopedTypeVariables #-} +{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, LambdaCase, ScopedTypeVariables #-} {-# LANGUAGE Safe #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif module Data.Interval.Internal ( Boundary(..) @@ -14,9 +12,6 @@ module Data.Interval.Internal , empty ) where -#if __GLASGOW_HASKELL__ < 710 -import Control.Applicative hiding (empty) -#endif import Control.DeepSeq import Data.Data import Data.ExtendedReal @@ -140,9 +135,7 @@ upperBound' = \case RightOpen _ q -> (Finite q, Open) BothOpen _ q -> (Finite q, Open) -#if __GLASGOW_HASKELL__ >= 708 type role Interval nominal -#endif instance (Ord r, Data r) => Data (Interval r) where gfoldl k z x = z interval `k` lowerBound' x `k` upperBound' x diff --git a/src/Data/IntervalMap/Base.hs b/src/Data/IntervalMap/Base.hs index 7322cd7..ebe3423 100644 --- a/src/Data/IntervalMap/Base.hs +++ b/src/Data/IntervalMap/Base.hs @@ -1,9 +1,7 @@ {-# OPTIONS_GHC -Wall #-} {-# LANGUAGE CPP, LambdaCase, ScopedTypeVariables, TypeFamilies, DeriveDataTypeable, MultiWayIf, GeneralizedNewtypeDeriving #-} {-# LANGUAGE Trustworthy #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.IntervalMap.Base @@ -104,16 +102,10 @@ import Data.Interval (Interval) import qualified Data.Interval as Interval import Data.IntervalSet (IntervalSet) import qualified Data.IntervalSet as IntervalSet -#if __GLASGOW_HASKELL__ < 710 -import Control.Applicative ((<$>)) -import Data.Traversable (Traversable(..)) -#endif #if __GLASGOW_HASKELL__ < 804 import Data.Monoid (Monoid(..)) #endif -#if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts -#endif -- ------------------------------------------------------------------------ -- The IntervalMap type @@ -125,9 +117,7 @@ import qualified GHC.Exts as GHCExts newtype IntervalMap r a = IntervalMap (Map (LB r) (Interval r, a)) deriving (Eq, Typeable) -#if __GLASGOW_HASKELL__ >= 708 type role IntervalMap nominal representational -#endif instance (Ord k, Show k, Show a) => Show (IntervalMap k a) where showsPrec p (IntervalMap m) = showParen (p > appPrec) $ @@ -175,22 +165,12 @@ instance Ord k => Monoid (IntervalMap k a) where instance Ord k => Semigroup.Semigroup (IntervalMap k a) where (<>) = union -#if !defined(VERSION_semigroups) stimes = Semigroup.stimesIdempotentMonoid -#else -#if MIN_VERSION_semigroups(0,17,0) - stimes = Semigroup.stimesIdempotentMonoid -#else - times1p _ a = a -#endif -#endif -#if __GLASGOW_HASKELL__ >= 708 instance Ord k => GHCExts.IsList (IntervalMap k a) where type Item (IntervalMap k a) = (Interval k, a) fromList = fromList toList = toList -#endif -- ------------------------------------------------------------------------ diff --git a/src/Data/IntervalMap/Strict.hs b/src/Data/IntervalMap/Strict.hs index 045b8d8..c60c88c 100644 --- a/src/Data/IntervalMap/Strict.hs +++ b/src/Data/IntervalMap/Strict.hs @@ -1,5 +1,5 @@ {-# OPTIONS_GHC -Wall #-} -{-# LANGUAGE CPP, BangPatterns, TupleSections #-} +{-# LANGUAGE BangPatterns, TupleSections #-} {-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | @@ -126,9 +126,6 @@ import qualified Data.IntervalMap.Base as B import qualified Data.IntervalSet as IntervalSet import Data.List (foldl') import qualified Data.Map.Strict as Map -#if __GLASGOW_HASKELL__ < 710 -import Control.Applicative ((<$>)) -#endif -- $strictness -- diff --git a/src/Data/IntervalRelation.hs b/src/Data/IntervalRelation.hs index 269e31f..b603651 100644 --- a/src/Data/IntervalRelation.hs +++ b/src/Data/IntervalRelation.hs @@ -1,5 +1,5 @@ {-# OPTIONS_GHC -Wall #-} -{-# LANGUAGE CPP, DeriveDataTypeable, DeriveGeneric #-} +{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-} {-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | diff --git a/src/Data/IntervalSet.hs b/src/Data/IntervalSet.hs index 226df9a..68cab0a 100644 --- a/src/Data/IntervalSet.hs +++ b/src/Data/IntervalSet.hs @@ -1,9 +1,7 @@ {-# OPTIONS_GHC -Wall #-} {-# LANGUAGE CPP, LambdaCase, ScopedTypeVariables, TypeFamilies, DeriveDataTypeable, MultiWayIf #-} {-# LANGUAGE Trustworthy #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : Data.IntervalSet @@ -80,9 +78,7 @@ import qualified Data.Interval as Interval #if __GLASGOW_HASKELL__ < 804 import Data.Monoid (Monoid(..)) #endif -#if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts -#endif -- | A set comprising zero or more non-empty, /disconnected/ intervals. -- @@ -90,9 +86,7 @@ import qualified GHC.Exts as GHCExts newtype IntervalSet r = IntervalSet (Map (Extended r) (Interval r)) deriving (Eq, Typeable) -#if __GLASGOW_HASKELL__ >= 708 type role IntervalSet nominal -#endif instance (Ord r, Show r) => Show (IntervalSet r) where showsPrec p (IntervalSet m) = showParen (p > appPrec) $ @@ -174,15 +168,7 @@ instance Ord r => Monoid (IntervalSet r) where instance (Ord r) => Semigroup.Semigroup (IntervalSet r) where (<>) = union -#if !defined(VERSION_semigroups) - stimes = Semigroup.stimesIdempotentMonoid -#else -#if MIN_VERSION_semigroups(0,17,0) stimes = Semigroup.stimesIdempotentMonoid -#else - times1p _ a = a -#endif -#endif lift1 :: Ord r => (Interval r -> Interval r) @@ -225,12 +211,10 @@ instance forall r. (Real r, Fractional r) => Fractional (IntervalSet r) where fromRational r = singleton (fromRational r) recip xs = lift1 recip (delete (Interval.singleton 0) xs) -#if __GLASGOW_HASKELL__ >= 708 instance Ord r => GHCExts.IsList (IntervalSet r) where type Item (IntervalSet r) = Interval r fromList = fromList toList = toList -#endif -- -----------------------------------------------------------------------