diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index a90b6f4..ba180b1 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.20231010 +# version: 0.19.20240514 # -# REGENDATA ("0.17.20231010",["github","cabal.project"]) +# REGENDATA ("0.19.20240514",["github","cabal.project"]) # name: Haskell-CI on: @@ -27,24 +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: ghc-9.8.1 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.8.1 + compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.3 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.6.3 + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.7 + - compiler: ghc-9.6.5 compilerKind: ghc - compilerVersion: 9.4.7 + compilerVersion: 9.6.5 + 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 @@ -65,42 +70,12 @@ 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 + setup-method: ghcup allow-failure: false fail-fast: false steps: @@ -108,21 +83,11 @@ jobs: 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.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 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.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.10.1.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 }} @@ -134,22 +99,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/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.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.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" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" @@ -206,7 +162,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 @@ -230,11 +186,11 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_binary_instances}" >> cabal.project - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package binary-instances" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "package binary-instances" >> 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 /^(binary-instances)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -242,7 +198,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 @@ -272,7 +228,7 @@ jobs: rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks 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 c1e69c9..6de4a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.5 + +- Support GHC-8.6.5...9.10.1 + ## 1.0.4 - Add instances for `ByteArray` from `data-array-byte` or `base` diff --git a/binary-instances.cabal b/binary-instances.cabal index 0145eeb..cabd6ae 100644 --- a/binary-instances.cabal +++ b/binary-instances.cabal @@ -1,6 +1,6 @@ +cabal-version: 2.2 name: binary-instances -version: 1.0.4 -x-revision: 3 +version: 1.0.5 synopsis: Orphan instances for binary description: `binary-instances` defines orphan instances for types in some popular packages. @@ -10,25 +10,19 @@ homepage: https://github.com/haskellari/binary-instances#readme bug-reports: https://github.com/haskellari/binary-instances/issues author: Oleg Grenrus maintainer: Oleg Grenrus -license: BSD3 +license: BSD-3-Clause license-file: LICENSE build-type: Simple -cabal-version: >=1.10 tested-with: - GHC ==7.6.3 - || ==7.8.4 - || ==7.10.3 - || ==8.0.2 - || ==8.2.2 - || ==8.4.4 - || ==8.6.5 + GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 - || ==9.4.7 - || ==9.6.3 - || ==9.8.1 + || ==9.4.8 + || ==9.6.5 + || ==9.8.2 + || ==9.10.1 extra-source-files: CHANGELOG.md @@ -40,21 +34,24 @@ library default-language: Haskell2010 hs-source-dirs: src build-depends: - aeson >=0.7.0.6 && <1.6 || >=2.0.0.0 && <2.3 - , base >=4.6.0.1 && <4.20 - , binary >=0.5.1.1 && <0.8.10 - , binary-orphans >=1.0.4 && <1.1 - , case-insensitive >=1.2.0.4 && <1.2.2 - , hashable >=1.2.3.3 && <1.5 - , primitive >=0.7.2.0 && <0.10 - , scientific >=0.3.3.8 && <0.4 - , tagged >=0.7.3 && <0.8.9 - , text >=1.2.0.6 && <1.3 || >=2.0 && <2.2 - , text-binary >=0.2.1.1 && <0.3 - , time-compat >=1.9.4 && <1.10 - , unordered-containers >=0.2.5.1 && <0.3 - , vector >=0.10.12.3 && <0.14 - , vector-binary-instances >=0.2.1.0 && <0.3 + , base >=4.6.0.1 && <4.21 + , binary >=0.5.1.1 && <0.8.10 + , text >=1.2.3.0 && <1.3 || >=2.0 && <2.2 + + build-depends: + , case-insensitive >=1.2.1.0 && <1.2.2 + , tagged >=0.8.8 && <0.8.9 + + build-depends: + , aeson ^>=2.2.2.0 + , binary-orphans ^>=1.0.5 + , hashable ^>=1.4.4.0 + , primitive ^>=0.9.0.0 + , scientific ^>=0.3.8.0 + , time-compat ^>=1.9.7 + , unordered-containers ^>=0.2.20 + , vector ^>=0.13.1.0 + , vector-binary-instances ^>=0.2.5.2 exposed-modules: Data.Binary.Instances @@ -76,7 +73,7 @@ test-suite binary-instances-test hs-source-dirs: test ghc-options: -Wall -fno-warn-orphans build-depends: - aeson + , aeson , base , binary , binary-instances @@ -84,12 +81,12 @@ test-suite binary-instances-test , case-insensitive , hashable , primitive - , QuickCheck >=2.13.1 && <2.15 - , quickcheck-instances >=0.3.29 && <0.4 + , QuickCheck ^>=2.14.3 || ^>=2.15.0.1 + , quickcheck-instances ^>=0.3.31 , scientific , tagged - , tasty >=0.10.1.2 && <1.6 - , tasty-quickcheck >=0.8.3.2 && <0.11 + , tasty ^>=1.5 + , tasty-quickcheck ^>=0.10.3 , text , time-compat , unordered-containers diff --git a/src/Data/Binary/Instances/Aeson.hs b/src/Data/Binary/Instances/Aeson.hs index 7725a1e..0bc10b8 100644 --- a/src/Data/Binary/Instances/Aeson.hs +++ b/src/Data/Binary/Instances/Aeson.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Binary.Instances.Aeson where @@ -10,12 +9,9 @@ import Data.Binary.Instances.Text () import Data.Binary.Instances.UnorderedContainers () import Data.Binary.Instances.Vector () -import qualified Data.Aeson as A - -#if MIN_VERSION_aeson(2,0,0) -import qualified Data.Aeson.Key as Key +import qualified Data.Aeson as A +import qualified Data.Aeson.Key as Key import qualified Data.Aeson.KeyMap as KM -#endif instance Binary A.Value where get = do @@ -36,7 +32,6 @@ instance Binary A.Value where put (A.Bool v) = put (4 :: Int) >> put v put A.Null = put (5 :: Int) -#if MIN_VERSION_aeson(2,0,0) instance Binary Key.Key where get = Key.fromText <$> get put = put . Key.toText @@ -44,4 +39,3 @@ instance Binary Key.Key where instance Binary v => Binary (KM.KeyMap v) where get = fmap KM.fromList get put = put . KM.toList -#endif diff --git a/src/Data/Binary/Instances/Hashable.hs b/src/Data/Binary/Instances/Hashable.hs index c3358c2..39d8a16 100644 --- a/src/Data/Binary/Instances/Hashable.hs +++ b/src/Data/Binary/Instances/Hashable.hs @@ -1,14 +1,11 @@ -{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Binary.Instances.Hashable where import Data.Binary.Orphans () -#if MIN_VERSION_hashable(1,2,5) import Data.Binary (Binary, get, put) import qualified Data.Hashable as Hashable instance (Hashable.Hashable a, Binary a) => Binary (Hashable.Hashed a) where get = fmap Hashable.hashed get put = put . Hashable.unhashed -#endif diff --git a/src/Data/Binary/Instances/Primitive.hs b/src/Data/Binary/Instances/Primitive.hs index f5b3f90..73b15cf 100644 --- a/src/Data/Binary/Instances/Primitive.hs +++ b/src/Data/Binary/Instances/Primitive.hs @@ -1,29 +1,4 @@ -{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Binary.Instances.Primitive where import Data.Binary.Orphans () - -#if !MIN_VERSION_primitive(0,8,0) -import Control.Monad (replicateM) -import Data.Binary (Binary, Get, Put, get, put) -import Data.Word (Word8) - -import qualified Data.Primitive as Prim - --- | @since 1.0.3 -instance Binary Prim.ByteArray where - put ba = put maxI >> go 0 - where - maxI :: Int - maxI = Prim.sizeofByteArray ba - - go :: Int -> Put - go i | i < maxI = put (Prim.indexByteArray ba i :: Word8) >> go (i + 1) - | otherwise = return () - - get = do - len <- get - xs <- replicateM len get - return (Prim.byteArrayFromListN len (xs :: [Word8])) -#endif diff --git a/src/Data/Binary/Instances/Scientific.hs b/src/Data/Binary/Instances/Scientific.hs index 26cdac5..cc5ab1d 100644 --- a/src/Data/Binary/Instances/Scientific.hs +++ b/src/Data/Binary/Instances/Scientific.hs @@ -1,16 +1,4 @@ -{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Binary.Instances.Scientific where import Data.Binary.Orphans () - -#if !(MIN_VERSION_scientific(0,3,4)) -import Control.Monad (liftM2) -import Data.Binary (Binary, Get, Put, get, put) - -import qualified Data.Scientific as S - -instance Binary S.Scientific where - get = liftM2 S.scientific get get - put s = put (S.coefficient s) >> put (S.base10Exponent s) -#endif diff --git a/src/Data/Binary/Instances/Text.hs b/src/Data/Binary/Instances/Text.hs index 8cd2152..d53a9c4 100644 --- a/src/Data/Binary/Instances/Text.hs +++ b/src/Data/Binary/Instances/Text.hs @@ -3,7 +3,3 @@ module Data.Binary.Instances.Text where import Data.Binary.Orphans () - -#if !(MIN_VERSION_text(1,2,1)) -import Data.Text.Binary () -#endif