Skip to content

Commit 4d7ff14

Browse files
committed
Support OneTuple-0.4
1 parent f17b2ca commit 4d7ff14

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
strategy:
3333
matrix:
3434
include:
35+
- compiler: ghc-9.6.0.20230210
36+
compilerKind: ghc
37+
compilerVersion: 9.6.0.20230210
38+
setup-method: ghcup
39+
allow-failure: true
3540
- compiler: ghc-9.4.4
3641
compilerKind: ghc
3742
compilerVersion: 9.4.4
@@ -149,7 +154,7 @@ jobs:
149154
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
150155
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
151156
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
152-
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
157+
if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
153158
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
154159
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
155160
env:
@@ -178,6 +183,18 @@ jobs:
178183
repository hackage.haskell.org
179184
url: http://hackage.haskell.org/
180185
EOF
186+
if $HEADHACKAGE; then
187+
cat >> $CABAL_CONFIG <<EOF
188+
repository head.hackage.ghc.haskell.org
189+
url: https://ghc.gitlab.haskell.org/head.hackage/
190+
secure: True
191+
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
192+
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
193+
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
194+
key-threshold: 3
195+
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
196+
EOF
197+
fi
181198
cat >> $CABAL_CONFIG <<EOF
182199
program-default-options
183200
ghc-options: $GHCJOBS +RTS -M3G -RTS
@@ -229,6 +246,9 @@ jobs:
229246
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
230247
cat >> cabal.project <<EOF
231248
EOF
249+
if $HEADHACKAGE; then
250+
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
251+
fi
232252
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(binary-orphans)$/; }' >> cabal.project.local
233253
cat cabal.project
234254
cat cabal.project.local

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.4.1
2+
3+
- Support OneTuple-0.4
4+
15
# 1.0.4
26

37
- Depend on `data-byte-array` to provide `Data.Array.Byte` instance

binary-orphans.cabal

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 1.12
22
name: binary-orphans
3-
version: 1.0.4
3+
version: 1.0.4.1
44
synopsis: Compatibility package for binary; provides instances
55
category: Data, Binary, Parsing, Compatibility
66
description:
@@ -28,6 +28,7 @@ tested-with:
2828
|| ==9.0.2
2929
|| ==9.2.7
3030
|| ==9.4.4
31+
|| ==9.6.1
3132

3233
extra-source-files: CHANGELOG.md
3334

@@ -55,7 +56,7 @@ library
5556
build-depends: semigroups >=0.18.5 && <0.20.1
5657

5758
if !impl(ghc >=9.2)
58-
build-depends: OneTuple >=0.3 && <0.4
59+
build-depends: OneTuple >=0.3 && <0.5
5960

6061
if impl(ghc >=8.0 && <9.4)
6162
build-depends: data-array-byte >=0.1.0.1 && <0.2
@@ -70,7 +71,7 @@ test-suite binary-orphans-test
7071
base
7172
, binary
7273
, binary-orphans
73-
, OneTuple >=0.3 && <0.4
74+
, OneTuple >=0.3 && <0.5
7475
, QuickCheck >=2.13.1 && <2.15
7576
, quickcheck-instances >=0.3.28 && <0.4
7677
, tagged >=0.8.6 && <0.8.7

src/Data/Binary/Orphans.hs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,18 @@ import Data.Void (Void, absurd)
3131
import GHC.Fingerprint (Fingerprint (..))
3232
import Numeric.Natural (Natural)
3333

34-
#if MIN_VERSION_base(4,16,0)
35-
import Data.Tuple (Solo (..))
34+
#if MIN_VERSION_base(4,18,0)
35+
import Data.Tuple (Solo (MkSolo))
36+
#elif MIN_VERSION_base(4,16,0)
37+
import Data.Tuple (Solo (Solo))
38+
#define MkSolo Solo
3639
#else
37-
import Data.Tuple.Solo (Solo (..))
40+
#if MIN_VERSION_OneTuple(0,4,0)
41+
import Data.Tuple.Solo (Solo (MkSolo))
42+
#else
43+
import Data.Tuple.Solo (Solo (Solo))
44+
#define MkSolo Solo
45+
#endif
3846
#endif
3947

4048
#if MIN_VERSION_base(4,9,0)
@@ -348,8 +356,8 @@ instance Binary a => Binary (Identity a) where
348356

349357
-- | @since 1.0.2
350358
instance Binary a => Binary (Solo a) where
351-
put (Solo x) = put x
352-
get = fmap Solo get
359+
put (MkSolo x) = put x
360+
get = fmap MkSolo get
353361

354362
#if MIN_VERSION_base(4,9,0)
355363
-- | @since 1.0.3

0 commit comments

Comments
 (0)