Skip to content

Commit 1bcd90d

Browse files
authored
Merge pull request #23 from haskellari/data-byte-array
Add instances for data-byte-array.ByteArray
2 parents 7a2e96e + 2c8acd6 commit 1bcd90d

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.0.4
2+
3+
- Add instances for `ByteArray` from `data-array-byte` or `base`
4+
- Support `primitive-0.8`
5+
- Support `tagged-0.8.7`
6+
17
## 1.0.3
28

39
- Add instance for `primitive`s `ByteArray`.

binary-instances.cabal

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: binary-instances
2-
version: 1.0.3
2+
version: 1.0.4
33
synopsis: Orphan instances for binary
44
description:
55
`binary-instances` defines orphan instances for types in some popular packages.
@@ -24,8 +24,8 @@ tested-with:
2424
|| ==8.8.4
2525
|| ==8.10.7
2626
|| ==9.0.2
27-
|| ==9.2.4
28-
|| ==9.4.1
27+
|| ==9.2.7
28+
|| ==9.4.4
2929

3030
extra-source-files: CHANGELOG.md
3131

@@ -40,12 +40,12 @@ library
4040
aeson >=0.7.0.6 && <1.6 || >=2.0.0.0 && <2.2
4141
, base >=4.6.0.1 && <4.18
4242
, binary >=0.5.1.1 && <0.8.10
43-
, binary-orphans >=1.0.3 && <1.1
43+
, binary-orphans >=1.0.4 && <1.1
4444
, case-insensitive >=1.2.0.4 && <1.2.2
4545
, hashable >=1.2.3.3 && <1.5
46-
, primitive >=0.7.2.0 && <0.8
46+
, primitive >=0.7.2.0 && <0.9
4747
, scientific >=0.3.3.8 && <0.4
48-
, tagged >=0.7.3 && <0.8.7
48+
, tagged >=0.7.3 && <0.8.8
4949
, text >=1.2.0.6 && <1.3 || >=2.0 && <2.1
5050
, text-binary >=0.2.1.1 && <0.3
5151
, time-compat >=1.9.4 && <1.10
@@ -82,7 +82,7 @@ test-suite binary-instances-test
8282
, hashable
8383
, primitive
8484
, QuickCheck >=2.13.1 && <2.15
85-
, quickcheck-instances >=0.3.28 && <0.4
85+
, quickcheck-instances >=0.3.29 && <0.4
8686
, scientific
8787
, tagged
8888
, tasty >=0.10.1.2 && <1.5
@@ -91,3 +91,6 @@ test-suite binary-instances-test
9191
, time-compat
9292
, unordered-containers
9393
, vector
94+
95+
if impl(ghc >=8.0 && <9.4)
96+
build-depends: data-array-byte

src/Data/Binary/Instances/Primitive.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module Data.Binary.Instances.Primitive where
44

55
import Data.Binary.Orphans ()
66

7+
#if !MIN_VERSION_primitive(0,8,0)
78
import Control.Monad (replicateM)
89
import Data.Binary (Binary, Get, Put, get, put)
910
import Data.Word (Word8)
@@ -25,3 +26,4 @@ instance Binary Prim.ByteArray where
2526
len <- get
2627
xs <- replicateM len get
2728
return (Prim.byteArrayFromListN len (xs :: [Word8]))
29+
#endif

test/Tests.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ import qualified Data.Time.Clock.System.Compat as Time
3232
import qualified Data.Time.Clock.TAI.Compat as Time
3333
import qualified Data.Time.LocalTime.Compat as Time
3434

35+
#if MIN_VERSION_base(4,9,0)
36+
import qualified Data.Array.Byte as AB
37+
#endif
38+
3539
main :: IO ()
3640
main = defaultMain tests
3741

@@ -72,6 +76,9 @@ tests = testGroup "Roundtrip"
7276
, roundtripProperty (undefined :: Vector Char)
7377
, roundtripProperty (undefined :: VU.Vector Char)
7478
, roundtripProperty (undefined :: Prim.ByteArray)
79+
#if MIN_VERSION_base(4,9,0)
80+
, roundtripProperty (undefined :: AB.ByteArray)
81+
#endif
7582
]
7683

7784
roundtrip :: (Eq a, Show a, Binary a) => a -> a -> Property

0 commit comments

Comments
 (0)