From ee3417d17d9e48d16c4556f46b38dd53f7d1a9d5 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Sun, 27 Oct 2024 09:51:56 -0400 Subject: [PATCH] Drop support for pre-8.0 versions of GHC --- .github/workflows/haskell-ci.yml | 115 +++++++++++-------------------- CHANGELOG.md | 3 + Data/Reify.hs | 14 ---- data-reify.cabal | 22 +++--- examples/example1.hs | 9 +-- examples/simplify.hs | 16 +---- spec/Data/ReifySpec.hs | 4 +- test/Test4.hs | 2 +- test/Test5.hs | 2 +- test/Test6.hs | 6 +- test/Test7.hs | 11 ++- 11 files changed, 65 insertions(+), 139 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 7dc1927..4b6c000 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.16.6 +# version: 0.19.20240708 # -# REGENDATA ("0.16.6",["github","cabal.project"]) +# REGENDATA ("0.19.20240708",["github","cabal.project"]) # name: Haskell-CI on: @@ -23,19 +23,29 @@ jobs: timeout-minutes: 60 container: - image: buildpack-deps:bionic + image: buildpack-deps:jammy continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - compiler: ghc-9.6.2 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.6.2 + compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.5 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.4.5 + compilerVersion: 9.8.2 + 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 @@ -56,79 +66,39 @@ jobs: - compiler: ghc-8.8.4 compilerKind: ghc compilerVersion: 8.8.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.6.5 compilerKind: ghc compilerVersion: 8.6.5 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.4.4 compilerKind: ghc compilerVersion: 8.4.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.2.2 compilerKind: ghc compilerVersion: 8.2.2 - setup-method: hvr-ppa + setup-method: ghcup 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 - allow-failure: false - - compiler: ghc-7.0.4 - compilerKind: ghc - compilerVersion: 7.0.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false fail-fast: false steps: - 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.19.2/x86_64-linux-ghcup-0.1.19.2 > "$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.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.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.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.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -140,20 +110,13 @@ jobs: 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/$HCKIND-$HCVER - 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.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.10.1.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.12.1.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" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" @@ -210,7 +173,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 @@ -238,7 +201,7 @@ jobs: package data-reify flags: +tests EOF - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(data-reify)$/; }' >> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(data-reify)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -246,7 +209,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 @@ -269,7 +232,7 @@ jobs: run: | if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi - 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 09102d1..843bed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## next [????.??.??] +* Drop support for pre-8.0 versions of GHC. + ## 0.6.3 [2020.10.12] * Fix a bug introduced in `data-reify-0.6.2` where `reifyGraph` could return `Graph`s with duplicate key-value pairs. diff --git a/Data/Reify.hs b/Data/Reify.hs index 7343db1..99ae78a 100644 --- a/Data/Reify.hs +++ b/Data/Reify.hs @@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} @@ -22,15 +21,6 @@ import Data.IntSet (IntSet) import System.Mem.StableName -#if !(MIN_VERSION_base(4,7,0)) -import Unsafe.Coerce -#endif - -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative -import Data.Traversable -#endif - -- | 'MuRef' is a class that provided a way to reference into a specific type, -- and a way to map over the deferenced internals. class MuRef a where @@ -139,11 +129,7 @@ instance Hashable DynStableName where instance Eq DynStableName where DynStableName m == DynStableName n = -#if MIN_VERSION_base(4,7,0) eqStableName m n -#else - m == unsafeCoerce n -#endif makeDynStableName :: a -> IO DynStableName makeDynStableName a = do diff --git a/data-reify.cabal b/data-reify.cabal index 640084c..ee2c814 100644 --- a/data-reify.cabal +++ b/data-reify.cabal @@ -25,13 +25,7 @@ Homepage: http://ku-fpg.github.io/software/data-reify/ Stability: alpha build-type: Simple Cabal-Version: >= 1.10 -tested-with: GHC == 7.0.4 - , GHC == 7.2.2 - , GHC == 7.4.2 - , GHC == 7.6.3 - , GHC == 7.8.4 - , GHC == 7.10.3 - , GHC == 8.0.2 +tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 @@ -39,8 +33,10 @@ tested-with: GHC == 7.0.4 , GHC == 8.10.7 , GHC == 9.0.2 , GHC == 9.2.8 - , GHC == 9.4.5 - , GHC == 9.6.2 + , GHC == 9.4.8 + , GHC == 9.6.6 + , GHC == 9.8.2 + , GHC == 9.10.1 extra-source-files: CHANGELOG.md, README.md source-repository head @@ -53,7 +49,10 @@ Flag tests Library - Build-Depends: base >= 4 && < 5, hashable, containers, unordered-containers + Build-Depends: base >= 4.9 && < 5 + , containers >= 0.5.7.1 + , hashable + , unordered-containers Exposed-modules: Data.Reify, Data.Reify.Graph @@ -66,8 +65,7 @@ test-suite spec type: exitcode-stdio-1.0 main-is: Spec.hs other-modules: Data.ReifySpec - build-depends: base >= 4 && < 5 - , base-compat >= 0.11 && < 0.15 + build-depends: base , data-reify , hspec == 2.* build-tool-depends: hspec-discover:hspec-discover == 2.* diff --git a/examples/example1.hs b/examples/example1.hs index 5b080b1..e03035d 100644 --- a/examples/example1.hs +++ b/examples/example1.hs @@ -1,17 +1,10 @@ -{-# LANGUAGE CPP, TypeFamilies, DeriveFunctor, DeriveFoldable, DeriveTraversable #-} +{-# LANGUAGE TypeFamilies, DeriveFunctor, DeriveFoldable, DeriveTraversable #-} module Main (DistF,Dist,D,share,expand,main) where import Data.Reify import Data.IntMap as IntMap -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative -import Data.Foldable -import Data.Monoid -import Data.Traversable -#endif - {- This example was written by Edward Kmett for Johan Tibell, and can be found at http://lpaste.net/74064 diff --git a/examples/simplify.hs b/examples/simplify.hs index 256c11d..362a726 100644 --- a/examples/simplify.hs +++ b/examples/simplify.hs @@ -15,27 +15,15 @@ module Main (main) where -- to define simplification -#if MIN_VERSION_containers(0,5,0) import qualified Data.Map.Strict as Map import Data.Map.Strict (Map) -#else -import qualified Data.Map as Map -import Data.Map (Map) -#endif import Data.Reify (Graph(Graph), Unique) import qualified Data.Set as Set -- for the example import Data.Reify (MuRef(mapDeRef), DeRef, reifyGraph) -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative (Applicative(..)) -import Data.Foldable (Foldable,foldMap) -import Data.Functor ((<$>)) -import Data.Monoid (Monoid(..)) -#endif - -#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0)) +#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..)) #endif @@ -70,10 +58,8 @@ newtype Hist a = Hist (Map a Int) count :: a -> Hist a count x = Hist (Map.singleton x 1) -#if __GLASGOW_HASKELL__ >= 800 instance (Ord a) => Semigroup (Hist a) where (<>) (Hist m1) (Hist m2) = Hist (Map.unionWith (+) m1 m2) -#endif instance (Ord a) => Monoid (Hist a) where mempty = Hist Map.empty diff --git a/spec/Data/ReifySpec.hs b/spec/Data/ReifySpec.hs index d8ef1ce..e686c26 100644 --- a/spec/Data/ReifySpec.hs +++ b/spec/Data/ReifySpec.hs @@ -1,13 +1,11 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# OPTIONS_GHC -Wno-orphans #-} module Data.ReifySpec where import qualified Data.List as L import Data.Reify -import Prelude () -import Prelude.Compat import Test.Hspec main :: IO () diff --git a/test/Test4.hs b/test/Test4.hs index fd8535f..73caa65 100644 --- a/test/Test4.hs +++ b/test/Test4.hs @@ -1,5 +1,5 @@ {-# LANGUAGE TypeFamilies #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# OPTIONS_GHC -Wno-orphans #-} module Main (main) where import Common diff --git a/test/Test5.hs b/test/Test5.hs index 4052914..3b25a2e 100644 --- a/test/Test5.hs +++ b/test/Test5.hs @@ -1,5 +1,5 @@ {-# LANGUAGE TypeFamilies #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# OPTIONS_GHC -Wno-orphans #-} module Main (main) where import Common diff --git a/test/Test6.hs b/test/Test6.hs index 652b941..72e1cd3 100644 --- a/test/Test6.hs +++ b/test/Test6.hs @@ -1,6 +1,6 @@ -{-# LANGUAGE TypeFamilies, UndecidableInstances, DeriveDataTypeable, +{-# LANGUAGE TypeFamilies, UndecidableInstances, RankNTypes, ExistentialQuantification, TypeOperators #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# OPTIONS_GHC -Wno-orphans #-} module Main (main) where import Common @@ -32,7 +32,7 @@ instance NewVar Exp where -- return $ Var $ toDyn fn data Exp = ExpVar Dynamic | ExpLit Int | ExpAdd Exp Exp - deriving (Typeable, Show) + deriving Show instance Eq Exp where diff --git a/test/Test7.hs b/test/Test7.hs index 977036a..d9773e9 100644 --- a/test/Test7.hs +++ b/test/Test7.hs @@ -1,11 +1,10 @@ -{-# LANGUAGE TypeFamilies, UndecidableInstances, DeriveDataTypeable, +{-# LANGUAGE TypeFamilies, UndecidableInstances, RankNTypes, ExistentialQuantification #-} module Main (main) where import Control.Applicative hiding (Const) import Data.Reify -import Data.Typeable import System.CPUTime import System.Environment @@ -13,7 +12,7 @@ import System.Environment import Prelude data Tree = Node Tree Tree | Leaf Int - deriving (Show,Eq,Typeable) + deriving (Show,Eq) data T s = N s s | L Int @@ -42,14 +41,14 @@ timeme :: Int -> (Int -> Tree) -> IO Float timeme n f = do i <- getCPUTime let g3 :: Tree - g3 = f n + g3 = f n reifyGraph g3 >>= \ (Graph xs _) -> putStr $ show (length xs) j <- getCPUTime let t :: Float t = fromIntegral ((j - i) `div` 1000000000) - putStrLn $ " " ++ show n ++ " ==> " ++ show (t / 1000) + putStrLn $ " " ++ show n ++ " ==> " ++ show (t / 1000) return t - + main :: IO () main = do (x:args) <- getArgs