Skip to content

Commit

Permalink
Merge pull request #298 from parsonsmatt/matt/ghc-94
Browse files Browse the repository at this point in the history
- Support GHC 9.4
- Drop 8.0.2 and 8.2.2 from tested-withs
- Some constraint bumps, add cabal.project `allow-newer` constraint on `store-core:text` to make benchmarks compile
  • Loading branch information
FinleyMcIlwaine committed Sep 24, 2022
2 parents c31a1c0 + 8da1a09 commit 00e9add
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 89 deletions.
62 changes: 29 additions & 33 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# This GitHub workflow config has been generated by a script via
#
# haskell-ci 'github' '--config=cabal.haskell-ci' 'cabal.project'
# haskell-ci 'github' 'cabal.project'
#
# To regenerate the script (for example after adjusting tested-with) run
#
# haskell-ci regenerate
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.14.3
# version: 0.15.20220920
#
# REGENDATA ("0.14.3",["github","--config=cabal.haskell-ci","cabal.project"])
# REGENDATA ("0.15.20220920",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -19,7 +19,7 @@ on:
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
timeout-minutes:
60
container:
Expand All @@ -28,6 +28,11 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.4.2
compilerKind: ghc
compilerVersion: 9.4.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.2
compilerKind: ghc
compilerVersion: 9.2.2
Expand All @@ -38,10 +43,10 @@ jobs:
compilerVersion: 9.0.1
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-8.10.1
- compiler: ghc-8.10.7
compilerKind: ghc
compilerVersion: 8.10.1
setup-method: hvr-ppa
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.8.3
compilerKind: ghc
Expand All @@ -58,16 +63,6 @@ jobs:
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
fail-fast: false
steps:
- name: apt
Expand All @@ -76,18 +71,18 @@ 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.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$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)
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.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
env:
HCKIND: ${{ matrix.compilerKind }}
Expand Down Expand Up @@ -210,17 +205,18 @@ jobs:
echo "packages: ${PKGDIR_serialise}" >> cabal.project
echo "packages: ${PKGDIR_binary_serialise_cbor}" >> cabal.project
echo "packages: ${PKGDIR_cborg_json}" >> cabal.project
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package cborg" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package cbor-tool" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package serialise" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package binary-serialise-cbor" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package cborg-json" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
echo "package cborg" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo "package cbor-tool" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo "package serialise" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo "package binary-serialise-cbor" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo "package cborg-json" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
allow-newer: store-core:text
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(binary-serialise-cbor|cbor-tool|cborg|cborg-json|serialise)$/; }' >> cabal.project.local
cat cabal.project
Expand Down Expand Up @@ -262,7 +258,7 @@ jobs:
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
$CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: unconstrained build
run: |
rm -f cabal.project.local
Expand Down
9 changes: 4 additions & 5 deletions binary-serialise-cbor/binary-serialise-cbor.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ category: Codec
build-type: Simple
cabal-version: 1.22
tested-with:
GHC == 8.0.2,
GHC == 8.2.2,
GHC == 8.4.4,
GHC == 8.6.5,
GHC == 8.8.3,
GHC == 8.10.1,
GHC == 8.10.7,
GHC == 9.0.1,
GHC == 9.2.2
GHC == 9.2.2,
GHC == 9.4.2

description:
This package is a shim around @cborg@, exposing an interface compatible with
Expand Down Expand Up @@ -49,7 +48,7 @@ library
exposed-modules: Data.Binary.Serialise.CBOR.Read

build-depends:
base >= 4.8 && < 4.17,
base >= 4.8 && < 4.18,
bytestring < 1.0,
cborg == 0.2.*,
serialise == 0.2.*
Expand Down
4 changes: 4 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ packages:
serialise/
binary-serialise-cbor/
cborg-json/

-- Needed for serialise benchmarks
allow-newer:
store-core:text
11 changes: 5 additions & 6 deletions cbor-tool/cbor-tool.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
tested-with:
GHC == 8.0.2,
GHC == 8.2.2,
GHC == 8.4.4,
GHC == 8.6.5,
GHC == 8.8.3,
GHC == 8.10.1,
GHC == 8.10.7,
GHC == 9.0.1,
GHC == 9.2.2
GHC == 9.2.2,
GHC == 9.4.2

executable cbor-tool
main-is: Main.hs
other-extensions: CPP, BangPatterns
ghc-options: -Wall
build-depends:
base >=4.7 && <4.17,
base >=4.7 && <4.18,
filepath >=1.0 && <1.5,
aeson >=0.7 && <2.1,
aeson >=0.7 && <2.2,
aeson-pretty >=0.8 && <0.9,
scientific >=0.3 && <0.4,
bytestring >=0.10 && <0.12,
Expand Down
13 changes: 6 additions & 7 deletions cborg-json/cborg-json.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,20 @@ build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
tested-with:
GHC == 8.0.2,
GHC == 8.2.2,
GHC == 8.4.4,
GHC == 8.6.5,
GHC == 8.8.3,
GHC == 8.10.1,
GHC == 8.10.7,
GHC == 9.0.1,
GHC == 9.2.2
GHC == 9.2.2,
GHC == 9.4.2

library
exposed-modules: Codec.CBOR.JSON
ghc-options: -Wall
build-depends:
base >=4.7 && < 4.17,
aeson >=0.7 && <2.1,
base >=4.7 && < 4.18,
aeson >=0.7 && <2.2,
aeson-pretty >=0.8 && <0.9,
unordered-containers >=0.2 && <0.3,
scientific >=0.3 && <0.4,
Expand All @@ -58,7 +57,7 @@ benchmark bench
other-modules:

build-depends:
base >= 4.6 && < 4.17,
base >= 4.6 && < 4.18,
cborg ,
cborg-json ,
aeson ,
Expand Down
15 changes: 7 additions & 8 deletions cborg/cborg.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ category: Codec
build-type: Simple
cabal-version: >= 1.10
tested-with:
GHC == 8.0.2,
GHC == 8.2.2,
GHC == 8.4.4,
GHC == 8.6.5,
GHC == 8.8.3,
GHC == 8.10.1,
GHC == 8.10.7,
GHC == 9.0.1,
GHC == 9.2.2
GHC == 9.2.2,
GHC == 9.4.2

extra-source-files:
ChangeLog.md
Expand Down Expand Up @@ -90,11 +89,11 @@ library

build-depends:
array >= 0.4 && < 0.6,
base >= 4.8 && < 4.17,
base >= 4.8 && < 4.18,
bytestring >= 0.10.4 && < 0.12,
containers >= 0.5 && < 0.7,
deepseq >= 1.0 && < 1.5,
ghc-prim >= 0.3.1.0 && < 0.9,
ghc-prim >= 0.3.1.0 && < 0.10,
half >= 0.2.2.3 && < 0.4,
primitive >= 0.5 && < 0.8,
text >= 1.1 && < 1.3 || >= 2.0 && <2.1
Expand Down Expand Up @@ -148,12 +147,12 @@ test-suite tests

build-depends:
array >= 0.4 && < 0.6,
base >= 4.7 && < 4.17,
base >= 4.7 && < 4.18,
base-orphans,
bytestring >= 0.10.4 && < 0.12,
text >= 1.1 && < 2.1,
cborg,
aeson >= 0.7 && < 2.1,
aeson >= 0.7 && < 2.2,
base64-bytestring >= 1.0 && < 1.3,
base16-bytestring >= 1.0 && < 1.1,
deepseq >= 1.0 && < 1.5,
Expand Down
29 changes: 26 additions & 3 deletions cborg/src/Codec/CBOR/Decoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,13 @@ toWord8 n = W8# (wordToWord8# n)
toWord16 n = W16# (wordToWord16# n)
toWord32 n = W32# (wordToWord32# n)
#if WORD_SIZE_IN_BITS == 64
#if MIN_VERSION_base(4,17,0)
toInt64 n = I64# (intToInt64# n)
toWord64 n = W64# (wordToWord64# n)
#else
toInt64 n = I64# n
toWord64 n = W64# n
#endif
#else
toInt64 n = I64# (intToInt64# n)
toWord64 n = W64# (wordToWord64# n)
Expand Down Expand Up @@ -748,7 +753,13 @@ decodeTag64 :: Decoder s Word64
{-# INLINE decodeTag64 #-}
decodeTag64 =
#if defined(ARCH_64bit)
Decoder (\k -> return (ConsumeTag (\w# -> k (W64# w#))))
Decoder (\k -> return (ConsumeTag (\w# -> k (W64#
#if MIN_VERSION_base(4,17,0)
(wordToWord64# w#)
#else
w#
#endif
))))
#else
Decoder (\k -> return (ConsumeTag64 (\w64# -> k (W64# w64#))))
#endif
Expand All @@ -769,7 +780,13 @@ decodeTag64Canonical :: Decoder s Word64
{-# INLINE decodeTag64Canonical #-}
decodeTag64Canonical =
#if defined(ARCH_64bit)
Decoder (\k -> return (ConsumeTagCanonical (\w# -> k (W64# w#))))
Decoder (\k -> return (ConsumeTagCanonical (\w# -> k (W64#
#if MIN_VERSION_base(4,17,0)
(wordToWord64# w#)
#else
w#
#endif
))))
#else
Decoder (\k -> return (ConsumeTag64Canonical (\w64# -> k (W64# w64#))))
#endif
Expand Down Expand Up @@ -968,7 +985,13 @@ type ByteOffset = Int64
--
-- @since 0.2.2.0
peekByteOffset :: Decoder s ByteOffset
peekByteOffset = Decoder (\k -> return (PeekByteOffset (\off# -> k (I64# off#))))
peekByteOffset = Decoder (\k -> return (PeekByteOffset (\off# -> k (I64#
#if MIN_VERSION_base(4,17,0)
(intToInt64# off#)
#else
off#
#endif
))))
{-# INLINE peekByteOffset #-}

-- | This captures the pattern of getting the byte offsets before and after
Expand Down
16 changes: 14 additions & 2 deletions cborg/src/Codec/CBOR/FlatTerm.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,24 @@ decodePreEncoded bs0 =
-- always starts by requesting initial input. Only decoders that
-- fail or return a value without looking at their input can give
-- a different initial result.
Read.Partial k <- Read.deserialiseIncremental decodeTermToken
result <- Read.deserialiseIncremental decodeTermToken
let
k =
case result of
Read.Partial a -> a
_ -> error "Failed to get a Partial"
k (Just bs)
collectOutput next

collectOutput :: Read.IDecode s TermToken -> ST.Lazy.ST s FlatTerm
collectOutput (Read.Fail _ _ err) = fail $ "toFlatTerm: encodePreEncoded "
collectOutput (Read.Fail _ _ err) =
#if MIN_VERSION_base(4,17,0)
error
#else
fail
#endif

$ "toFlatTerm: encodePreEncoded "
++ "used with invalid CBOR: "
++ show err
collectOutput (Read.Partial k) = ST.Lazy.strictToLazyST (k Nothing)
Expand Down

0 comments on commit 00e9add

Please sign in to comment.