From 567cea54a67197e1f95b6e9d671dc270f2958f7d Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 2 Jun 2024 15:48:15 +0300 Subject: [PATCH] Support GHC-8.6.5...9.10.1 --- .github/workflows/haskell-ci.yml | 164 +++++++++---------------------- ChangeLog.md | 4 + src/Data/TreeDiff/Class.hs | 39 ++------ src/Data/TreeDiff/Expr.hs | 3 - src/Data/TreeDiff/Golden.hs | 2 - src/Data/TreeDiff/OMap.hs | 16 +-- src/Data/TreeDiff/Parser.hs | 2 - src/Data/TreeDiff/Pretty.hs | 2 +- tests/Tests.hs | 10 +- tree-diff.cabal | 100 +++++++------------ 10 files changed, 100 insertions(+), 242 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 16522d5..5f8ba92 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.17.20240109 +# version: 0.19.20240514 # -# REGENDATA ("0.17.20240109",["github","cabal.project"]) +# REGENDATA ("0.19.20240514",["github","cabal.project"]) # name: Haskell-CI on: @@ -27,29 +27,29 @@ 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 + - compiler: ghc-9.10.1 + compilerKind: ghc + compilerVersion: 9.10.1 + setup-method: ghcup allow-failure: false - - compiler: ghc-9.8.1 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.8.1 + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.3 + - compiler: ghc-9.6.5 compilerKind: ghc - compilerVersion: 9.6.3 + compilerVersion: 9.6.5 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.7 + - compiler: ghc-9.4.8 compilerKind: ghc - compilerVersion: 9.4.7 + compilerVersion: 9.4.8 setup-method: ghcup allow-failure: false - compiler: ghc-9.2.8 @@ -70,85 +70,24 @@ 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 - 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 + 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" 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" 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" 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 }} @@ -156,33 +95,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 >= 70600)) -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 }} @@ -219,8 +149,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 @@ -236,14 +164,14 @@ jobs: - name: install cabal-docspec run: | mkdir -p $HOME/.cabal/bin - curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20231219/cabal-docspec-0.0.0.20231219-x86_64-linux.xz > cabal-docspec.xz - echo '8b60448275466bbe2b9409741b5dd07a41c541283017b95b44efe6e31379d067 cabal-docspec.xz' | sha256sum -c - + curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20240414/cabal-docspec-0.0.0.20240414-x86_64-linux.xz > cabal-docspec.xz + echo '2d18a3f79619e8ec5f11870f926f6dc2616e02a6c889315b7f82044b95a1adb9 cabal-docspec.xz' | sha256sum -c - xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec rm -f cabal-docspec.xz chmod a+x $HOME/.cabal/bin/cabal-docspec cabal-docspec --version - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: source - name: initial cabal.project for sdist @@ -267,11 +195,11 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_tree_diff}" >> cabal.project - if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo "package tree-diff" >> cabal.project ; fi - if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "package tree-diff" >> cabal.project + echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(tree-diff)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -279,7 +207,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 @@ -296,18 +224,18 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - name: tests run: | - if [ $((! GHCJSARITH && HCNUMVER >= 70600)) -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: docspec run: | - if [ $((! GHCJSARITH && HCNUMVER >= 80000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 80000)) -ne 0 ] ; then cabal-docspec $ARG_COMPILER ; fi + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all + cabal-docspec $ARG_COMPILER - name: cabal check run: | cd ${PKGDIR_tree_diff} || false ${CABAL} -vnormal check - name: haddock run: | - if [ $((! GHCJSARITH && HCNUMVER >= 70800)) -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 @@ -317,13 +245,13 @@ jobs: rm -f cabal.project.local - name: constraint set random-hashable run: | - if [ $((! GHCJSARITH && HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' all --dry-run ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then cabal-plan topo | sort ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' --dependencies-only -j2 all ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' all ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' all ; fi + if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' all --dry-run ; fi + if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then cabal-plan topo | sort ; fi + if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' --dependencies-only -j2 all ; fi + if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' all ; fi + if [ $((HCNUMVER >= 90400 && HCNUMVER < 90600)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='hashable >=1.3.2.0' --constraint='hashable +random-initial-seed' 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 af8c7f1..41c477f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +## 0.3.1 + +- Support GHC-8.6.5...9.10.1 + ## 0.3 - Breaking change: diff --git a/src/Data/TreeDiff/Class.hs b/src/Data/TreeDiff/Class.hs index c22010b..d87667b 100644 --- a/src/Data/TreeDiff/Class.hs +++ b/src/Data/TreeDiff/Class.hs @@ -1,14 +1,12 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE EmptyCase #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708 -{-# LANGUAGE EmptyCase #-} -#endif -- | A 'ToExpr' class. module Data.TreeDiff.Class ( ediff, @@ -20,10 +18,9 @@ module Data.TreeDiff.Class ( GToExpr, ) where -import Data.Foldable (toList) -import Data.List (sort) -import Data.List.Compat (uncons) -import Data.Proxy (Proxy (..)) +import Data.Foldable (toList) +import Data.List (sort, uncons) +import Data.Proxy (Proxy (..)) import GHC.Generics (Constructor (..), Generic (..), K1 (..), M1 (..), Selector (..), U1 (..), V1, (:*:) (..), (:+:) (..)) @@ -43,10 +40,6 @@ import Data.Void (Void) import Data.Word import Numeric.Natural (Natural) -#ifdef MIN_VERSION_generic_deriving -import Generics.Deriving.Instances () -#endif - import qualified Data.Monoid as Mon import qualified Data.Ratio as Ratio import qualified Data.Semigroup as Semi @@ -94,11 +87,9 @@ import qualified Data.HashMap.Strict as HM import qualified Data.HashSet as HS -- aeson -import qualified Data.Aeson as Aeson -#if MIN_VERSION_aeson(2,0,0) +import qualified Data.Aeson as Aeson import qualified Data.Aeson.Key as Key import qualified Data.Aeson.KeyMap as KM -#endif -- strict import qualified Data.Strict as Strict @@ -107,11 +98,7 @@ import qualified Data.Strict as Strict import Data.These (These (..)) -- primitive -import qualified Data.Primitive as Prim - -#if MIN_VERSION_base(4,9,0) -import Data.Array.Byte (ByteArray (..)) -#endif +import qualified Data.Primitive as Prim -- $setup -- >>> :set -XDeriveGeneric @@ -202,11 +189,7 @@ instance (GSumToExpr f, GSumToExpr g) => GSumToExpr (f :+: g) where gsumToExpr (R1 x) = gsumToExpr x instance GSumToExpr V1 where -#if __GLASGOW_HASKELL__ >= 708 gsumToExpr x = case x of {} -#else - gsumToExpr x = x `seq` error "panic: V1 value" -#endif instance (Constructor c, GProductToExpr f) => GSumToExpr (M1 i c f) where gsumToExpr z@(M1 x) = case gproductToExpr x of @@ -561,13 +544,11 @@ instance (ToExpr k) => ToExpr (HS.HashSet k) where instance ToExpr Aeson.Value -#if MIN_VERSION_aeson(2,0,0) instance ToExpr Key.Key where toExpr = stringToExpr "Key.concat" . unconcat T.uncons . Key.toText instance ToExpr a => ToExpr (KM.KeyMap a) where toExpr x = App "KM.fromList" [ toExpr $ KM.toList x ] -#endif ------------------------------------------------------------------------------- -- strict @@ -601,11 +582,3 @@ instance (ToExpr a, ToExpr b) => ToExpr (These a b) where -- | @since 0.2.2 instance ToExpr Prim.ByteArray where toExpr ba = App "Prim.byteArrayFromList" [toExpr (Prim.foldrByteArray (:) [] ba :: [Word8])] - -#if !MIN_VERSION_primitive(0,8,0) && MIN_VERSION_base(4,9,0) --- | @since 0.2.2 -instance ToExpr ByteArray where - toExpr (ByteArray ba) = App "byteArrayFromList" [toExpr (Prim.foldrByteArray (:) [] (Prim.ByteArray ba) :: [Word8])] -#endif - --- TODO: add more instances diff --git a/src/Data/TreeDiff/Expr.hs b/src/Data/TreeDiff/Expr.hs index 7be7583..4910e71 100644 --- a/src/Data/TreeDiff/Expr.hs +++ b/src/Data/TreeDiff/Expr.hs @@ -9,9 +9,6 @@ module Data.TreeDiff.Expr ( exprDiff, ) where -import Prelude () -import Prelude.Compat - import Control.DeepSeq (NFData (..)) import Data.Semialign (alignWith) import Data.These (These (..)) diff --git a/src/Data/TreeDiff/Golden.hs b/src/Data/TreeDiff/Golden.hs index 52aa1f8..f827e02 100644 --- a/src/Data/TreeDiff/Golden.hs +++ b/src/Data/TreeDiff/Golden.hs @@ -4,8 +4,6 @@ module Data.TreeDiff.Golden ( ) where import Data.TreeDiff -import Prelude () -import Prelude.Compat import System.Console.ANSI (SGR (Reset), setSGRCode) import Text.Parsec (eof, parse) import Text.Parsec.Text () diff --git a/src/Data/TreeDiff/OMap.hs b/src/Data/TreeDiff/OMap.hs index 206b5e1..77befee 100644 --- a/src/Data/TreeDiff/OMap.hs +++ b/src/Data/TreeDiff/OMap.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} -- | Map which remembers the 'fromList' order. -- This module is minimal on purpose. @@ -15,18 +14,13 @@ module Data.TreeDiff.OMap ( elems, ) where -import Data.List (sortBy) -import Data.Ord (comparing) -import Data.Semialign (Semialign (..)) -import Data.These (These (..)) -import Control.DeepSeq (NFData (..)) +import Control.DeepSeq (NFData (..)) +import Data.List (sortBy) +import Data.Ord (comparing) +import Data.Semialign (Semialign (..)) +import Data.These (These (..)) -#if MIN_VERSION_containers(0,5,0) import qualified Data.Map.Strict as Map -#else -import qualified Data.Map as Map -#endif - import qualified Test.QuickCheck as QC -- $setup diff --git a/src/Data/TreeDiff/Parser.hs b/src/Data/TreeDiff/Parser.hs index 1d8a624..f2be32b 100644 --- a/src/Data/TreeDiff/Parser.hs +++ b/src/Data/TreeDiff/Parser.hs @@ -8,8 +8,6 @@ module Data.TreeDiff.Parser ( import Control.Applicative (many, optional, (<|>)) import Data.Char (chr, isAlphaNum, isPunctuation, isSymbol) -import Prelude () -import Prelude.Compat import Text.Parser.Char (CharParsing (anyChar, char, satisfy)) import Text.Parser.Combinators (between, ()) diff --git a/src/Data/TreeDiff/Pretty.hs b/src/Data/TreeDiff/Pretty.hs index ece312f..f66208a 100644 --- a/src/Data/TreeDiff/Pretty.hs +++ b/src/Data/TreeDiff/Pretty.hs @@ -28,7 +28,7 @@ import Data.Char (isAlphaNum, isPunctuation, isSymbol, ord) import Data.Either (partitionEithers) import Data.TreeDiff.Expr import Numeric (showHex) -import Text.Read.Compat (readMaybe) +import Text.Read (readMaybe) import qualified Data.TreeDiff.OMap as OMap import qualified Text.PrettyPrint as HJ diff --git a/tests/Tests.hs b/tests/Tests.hs index 813388d..067a2ea 100644 --- a/tests/Tests.hs +++ b/tests/Tests.hs @@ -1,21 +1,15 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} module Main (main) where +import Data.Array.Byte (ByteArray (..)) import Data.Proxy (Proxy (..)) import Data.Word (Word8) import GHC.Generics (Generic) -import Prelude () -import Prelude.Compat import Test.QuickCheck (Property, counterexample, (===)) import Test.Tasty (TestTree, defaultMain, testGroup) import Test.Tasty.Golden.Advanced (goldenTest) import Test.Tasty.QuickCheck (testProperty) -#if MIN_VERSION_base(4,9,0) -import Data.Array.Byte (ByteArray (..)) -#endif - import qualified Data.HashSet as HS import qualified Data.Primitive as Prim import qualified Text.Parsec as P @@ -161,9 +155,7 @@ instance ToExpr Empty -- test that we have both instances. data ByteArrays = ByteArrays Prim.ByteArray -#if MIN_VERSION_base(4,9,0) ByteArray -#endif deriving Generic instance ToExpr ByteArrays diff --git a/tree-diff.cabal b/tree-diff.cabal index 86e36dd..4085d23 100644 --- a/tree-diff.cabal +++ b/tree-diff.cabal @@ -1,7 +1,6 @@ cabal-version: 2.2 name: tree-diff -version: 0.3.0.1 -x-revision: 5 +version: 0.3.1 synopsis: Diffing of (expression) trees. category: Data, Testing description: @@ -45,22 +44,15 @@ extra-source-files: README.md tested-with: - GHC ==7.4.2 - || ==7.6.3 - || ==7.8.4 - || ==7.10.3 - || ==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.7 - || ==9.6.3 - || ==9.8.1 - , GHCJS ==8.4 + GHC ==8.6.5 + || ==8.8.4 + || ==8.10.7 + || ==9.0.2 + || ==9.2.8 + || ==9.4.8 + || ==9.6.5 + || ==9.8.2 + || ==9.10.1 extra-source-files: fixtures/exfoo.expr @@ -88,51 +80,34 @@ library -- GHC boot libraries build-depends: - , base >=4.5 && <4.20 - , bytestring ^>=0.9.2.1 || ^>=0.10.0.2 || ^>=0.11.0.0 || ^>=0.12.0.2 - , containers ^>=0.4.2.1 || ^>=0.5.0.0 || ^>=0.6.0.1 - , deepseq ^>=1.3.0.0 || ^>=1.4.0.0 || ^>=1.5.0.0 + , base >=4.12.0.0 && <4.21 + , bytestring ^>=0.10.8.2 || ^>=0.11.0.0 || ^>=0.12.0.2 + , containers ^>=0.6.0.1 || ^>=0.7 + , deepseq ^>=1.4.4.0 || ^>=1.5.0.0 , parsec ^>=3.1.13.0 , pretty ^>=1.1.1.0 , text ^>=1.2.3.0 || ^>=2.0 || ^>=2.1 - , time ^>=1.4 || ^>=1.5.0.1 || ^>=1.6.0.1 || ^>=1.8.0.2 || ^>=1.9.3 || ^>=1.10 || ^>=1.11 || ^>=1.12 + , time ^>=1.8.0.2 || ^>=1.9.3 || ^>=1.10 || ^>=1.11 || ^>=1.12 build-depends: - , aeson ^>=1.4.6.0 || ^>=1.5.6.0 || ^>=2.0.0.0 || ^>=2.1.0.0 || ^>=2.2.0.0 - , ansi-terminal >=0.10 && <0.12 || ^>=1.0 || ^>=1.1 - , ansi-wl-pprint ^>=0.6.8.2 || ^>=1.0.2 - , base-compat ^>=0.10.5 || ^>=0.11 || ^>=0.12 || ^>=0.13 - , bytestring-builder ^>=0.10.8.2.0 - , hashable ^>=1.2.7.0 || ^>=1.3.0.0 || ^>=1.4.0.1 - , parsers ^>=0.12.10 - , primitive ^>=0.7.1.0 || ^>=0.8.0.0 || ^>=0.9.0.0 - , QuickCheck ^>=2.14.2 - , scientific ^>=0.3.6.2 - , semialign ^>=1.2.0.1 || ^>=1.3 - , strict ^>=0.4.0.1 || ^>=0.5 - , tagged ^>=0.8.6 - , these ^>=1.1.1.1 || ^>=1.2 - , unordered-containers ^>=0.2.8.0 - , uuid-types ^>=1.0.3 - , vector ^>=0.12.0.0 || ^>=0.13.0.0 - - if impl(ghc <7.5) - build-depends: ghc-prim - - if !impl(ghc >=8.0) - build-depends: semigroups >=0.19.1 && <0.21 - - if !impl(ghc >=7.8) - build-depends: generic-deriving >=1.13.1 && <1.15 - - if !impl(ghc >=7.10) - build-depends: - , nats ^>=1.1.2 - , transformers ^>=0.3.0.0 || ^>=0.4.2.0 || ^>=0.5.2.0 || ^>=0.6 - , void ^>=0.7.3 + , aeson ^>=2.2.0.0 + , ansi-terminal ^>=1.1 + , ansi-wl-pprint ^>=1.0.2 + , hashable ^>=1.4.4.0 + , parsers ^>=0.12.11 + , primitive ^>=0.9.0.0 + , QuickCheck ^>=2.14.2 || ^>=2.15 + , scientific ^>=0.3.8.0 + , semialign ^>=1.3.1 + , strict ^>=0.5 + , tagged ^>=0.8.8 + , these ^>=1.2.1 + , unordered-containers ^>=0.2.20 + , uuid-types ^>=1.0.6 + , vector ^>=0.13.1.0 if (impl(ghc >=8) && !impl(ghc >=9.4)) - build-depends: data-array-byte >=0.1.0.1 && <0.2 + build-depends: data-array-byte ^>=0.1.0.1 other-extensions: CPP @@ -160,7 +135,6 @@ test-suite tree-diff-test , ansi-terminal , ansi-wl-pprint , base - , base-compat , parsec , primitive , QuickCheck @@ -176,10 +150,10 @@ test-suite tree-diff-test -- extra dependencies build-depends: - , tasty ^>=1.2 || ^>=1.3.1 || ^>=1.4.2 || ^>=1.5 - , tasty-golden ^>=2.3.1.1 - , tasty-quickcheck ^>=0.10.1 - , trifecta >=2 && <2.2 + , tasty ^>=1.5 + , tasty-golden ^>=2.3.5 + , tasty-quickcheck ^>=0.10.3 + , trifecta ^>=2.1.4 benchmark tree-diff-bench default-language: Haskell2010 @@ -196,5 +170,5 @@ benchmark tree-diff-bench -- extra dependencies build-depends: - , criterion ^>=1.6.0.0 - , Diff ^>=0.4.0 || ^>=0.5 + , criterion ^>=1.6.3.0 + , Diff ^>=0.5