Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GHC-8.6.5...9.10.1 #29

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 34 additions & 78 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -65,64 +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
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.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 }}
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -230,19 +186,19 @@ 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 <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(binary-instances)$/; }' >> 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
run: |
$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
Expand Down Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
65 changes: 31 additions & 34 deletions binary-instances.cabal
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -10,25 +10,19 @@ homepage: https://github.com/haskellari/binary-instances#readme
bug-reports: https://github.com/haskellari/binary-instances/issues
author: Oleg Grenrus <[email protected]>
maintainer: Oleg Grenrus <[email protected]>
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

Expand All @@ -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
Expand All @@ -76,20 +73,20 @@ test-suite binary-instances-test
hs-source-dirs: test
ghc-options: -Wall -fno-warn-orphans
build-depends:
aeson
, aeson
, base
, binary
, binary-instances
, bytestring
, 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
Expand Down
10 changes: 2 additions & 8 deletions src/Data/Binary/Instances/Aeson.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Binary.Instances.Aeson where

Expand All @@ -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
Expand All @@ -36,12 +32,10 @@ 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

instance Binary v => Binary (KM.KeyMap v) where
get = fmap KM.fromList get
put = put . KM.toList
#endif
3 changes: 0 additions & 3 deletions src/Data/Binary/Instances/Hashable.hs
Original file line number Diff line number Diff line change
@@ -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
25 changes: 0 additions & 25 deletions src/Data/Binary/Instances/Primitive.hs
Original file line number Diff line number Diff line change
@@ -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
Loading