Skip to content

Commit 55c8b3e

Browse files
authored
Merge pull request #182 from bgamari/wip/ghc-T19631
Changes for GHC 9.2.1
2 parents bccbece + 799af99 commit 55c8b3e

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

binary.cabal

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
cabal-version: 3.0
2+
13
-- To run tests and binaries you'll need to rename the name of the library
24
-- and all the local dependencies on it. If not, cabal is unable to come up
35
-- with a build plan.
@@ -8,7 +10,7 @@
810

911
name: binary
1012
version: 0.8.8.0
11-
license: BSD3
13+
license: BSD-3-Clause
1214
license-file: LICENSE
1315
author: Lennart Kolmodin <[email protected]>
1416
maintainer: Lennart Kolmodin, Don Stewart <[email protected]>
@@ -25,7 +27,6 @@ synopsis: Binary serialisation for Haskell values using lazy ByteStrings
2527
category: Data, Parsing
2628
stability: provisional
2729
build-type: Simple
28-
cabal-version: >= 1.8
2930
tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC ==8.2.2, GHC == 8.4.4, GHC == 8.6.5
3031
extra-source-files:
3132
README.md changelog.md docs/hcar/binary-Lb.tex tools/derive/*.hs
@@ -59,6 +60,7 @@ library
5960

6061
if impl(ghc >= 8.0)
6162
ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
63+
default-language: Haskell2010
6264

6365
test-suite qc
6466
type: exitcode-stdio-1.0
@@ -83,6 +85,7 @@ test-suite qc
8385
if impl(ghc <= 7.6)
8486
-- prior to ghc-7.4 generics lived in ghc-prim
8587
build-depends: ghc-prim
88+
default-language: Haskell2010
8689

8790

8891
test-suite read-write-file
@@ -104,6 +107,7 @@ test-suite read-write-file
104107
if impl(ghc <= 7.6)
105108
-- prior to ghc-7.4 generics lived in ghc-prim
106109
build-depends: ghc-prim
110+
default-language: Haskell2010
107111

108112

109113
benchmark bench
@@ -124,6 +128,7 @@ benchmark bench
124128
if impl(ghc <= 7.6)
125129
-- prior to ghc-7.4 generics lived in ghc-prim
126130
build-depends: ghc-prim
131+
default-language: Haskell2010
127132

128133

129134
benchmark get
@@ -145,6 +150,7 @@ benchmark get
145150
if impl(ghc <= 7.6)
146151
-- prior to ghc-7.4 generics lived in ghc-prim
147152
build-depends: ghc-prim
153+
default-language: Haskell2010
148154

149155

150156
benchmark put
@@ -163,6 +169,7 @@ benchmark put
163169
if impl(ghc <= 7.6)
164170
-- prior to ghc-7.4 generics lived in ghc-prim
165171
build-depends: ghc-prim
172+
default-language: Haskell2010
166173

167174
benchmark generics-bench
168175
type: exitcode-stdio-1.0
@@ -192,6 +199,7 @@ benchmark generics-bench
192199
if impl(ghc <= 7.6)
193200
-- prior to ghc-7.4 generics lived in ghc-prim
194201
build-depends: ghc-prim
202+
default-language: Haskell2010
195203

196204
benchmark builder
197205
type: exitcode-stdio-1.0
@@ -210,3 +218,4 @@ benchmark builder
210218
if impl(ghc <= 7.6)
211219
-- prior to ghc-7.4 generics lived in ghc-prim
212220
build-depends: ghc-prim
221+
default-language: Haskell2010

src/Data/Binary/Class.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ import Numeric.Natural
110110

111111
import qualified Data.Fixed as Fixed
112112

113+
#if __GLASGOW_HASKELL__ >= 901
114+
import GHC.Exts (Levity(Lifted,Unlifted))
115+
#endif
116+
113117
--
114118
-- This isn't available in older Hugs or older GHC
115119
--
@@ -885,8 +889,13 @@ instance Binary RuntimeRep where
885889
put (VecRep a b) = putWord8 0 >> put a >> put b
886890
put (TupleRep reps) = putWord8 1 >> put reps
887891
put (SumRep reps) = putWord8 2 >> put reps
892+
#if __GLASGOW_HASKELL__ >= 901
893+
put (BoxedRep Lifted) = putWord8 3
894+
put (BoxedRep Unlifted) = putWord8 4
895+
#else
888896
put LiftedRep = putWord8 3
889897
put UnliftedRep = putWord8 4
898+
#endif
890899
put IntRep = putWord8 5
891900
put WordRep = putWord8 6
892901
put Int64Rep = putWord8 7
@@ -911,8 +920,13 @@ instance Binary RuntimeRep where
911920
0 -> VecRep <$> get <*> get
912921
1 -> TupleRep <$> get
913922
2 -> SumRep <$> get
923+
#if __GLASGOW_HASKELL__ >= 901
924+
3 -> pure (BoxedRep Lifted)
925+
4 -> pure (BoxedRep Unlifted)
926+
#else
914927
3 -> pure LiftedRep
915928
4 -> pure UnliftedRep
929+
#endif
916930
5 -> pure IntRep
917931
6 -> pure WordRep
918932
7 -> pure Int64Rep

0 commit comments

Comments
 (0)