binary-instances 1.0.1 → 1.0.2
raw patch · 4 files changed
+33/−5 lines, 4 filesdep +bytestringdep ~aesondep ~basedep ~binaryPVP ok
version bump matches the API change (PVP)
Dependencies added: bytestring
Dependency ranges changed: aeson, base, binary, hashable, tasty, text, vector
API changes (from Hackage documentation)
+ Data.Binary.Instances.Aeson: instance Data.Binary.Class.Binary Data.Aeson.Key.Key
+ Data.Binary.Instances.Aeson: instance Data.Binary.Class.Binary v => Data.Binary.Class.Binary (Data.Aeson.KeyMap.KeyMap v)
Files
- CHANGELOG.md +4/−0
- binary-instances.cabal +7/−5
- src/Data/Binary/Instances/Aeson.hs +16/−0
- test/Tests.hs +6/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+## 1.0.2++- Support `aeson-2.0.0.0`+ ## 1.0.1 - Add instances for `time-1.11` types: `Month`, `Quarter`, `QuarterOfYear`
binary-instances.cabal view
@@ -1,5 +1,5 @@ name: binary-instances-version: 1.0.1+version: 1.0.2 synopsis: Orphan instances for binary description: `binary-instances` defines orphan instances for types in some popular packages.@@ -22,7 +22,8 @@ || ==8.4.4 || ==8.6.5 || ==8.8.4- || ==8.10.2+ || ==8.10.4+ || ==9.0.1 extra-source-files: CHANGELOG.md @@ -34,8 +35,8 @@ default-language: Haskell2010 hs-source-dirs: src build-depends:- aeson >=0.7.0.6 && <1.6- , base >=4.6.0.1 && <4.15+ aeson >=0.7.0.6 && <1.6 || >=2.0.0.0 && <2.1+ , base >=4.6.0.1 && <4.16 , binary >=0.5.1.1 && <0.8.9 , binary-orphans >=1.0.1 && <1.1 , case-insensitive >=1.2.0.4 && <1.2.2@@ -72,13 +73,14 @@ , base , binary , binary-instances+ , bytestring , case-insensitive , hashable , QuickCheck >=2.13.1 && <2.15 , quickcheck-instances >=0.3.25 && <0.4 , scientific , tagged- , tasty >=0.10.1.2 && <1.4+ , tasty >=0.10.1.2 && <1.5 , tasty-quickcheck >=0.8.3.2 && <0.11 , text , time-compat
src/Data/Binary/Instances/Aeson.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Binary.Instances.Aeson where @@ -11,6 +12,11 @@ import qualified Data.Aeson as A +#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key as Key+import qualified Data.Aeson.KeyMap as KM+#endif+ instance Binary A.Value where get = do t <- get :: Get Int@@ -29,3 +35,13 @@ put (A.Number v) = put (3 :: Int) >> put v 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
test/Tests.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} module Main (main) where @@ -10,6 +11,7 @@ import Test.Tasty (TestTree, defaultMain, testGroup) import Test.Tasty.QuickCheck (testProperty) +import Data.ByteString (ByteString) import Data.CaseInsensitive (CI) import Data.HashMap.Lazy (HashMap) import Data.HashSet (HashSet)@@ -54,7 +56,11 @@ , roundtripProperty (undefined :: Time.Quarter) , roundtripProperty (undefined :: Time.Month) -- case-insensitive & text+#if __GLASGOW_HASKELL__ <807+ -- https://github.com/haskell/text/issues/227 , roundtripProperty (undefined :: (CI Text))+#endif+ , roundtripProperty (undefined :: (CI ByteString)) -- semigroups / monoids , roundtripProperty (undefined :: (Sum Int)) -- tagged