aeson 1.5.3.0 → 1.5.4.0
raw patch · 7 files changed
+23/−5 lines, 7 filesdep ~ghc-primdep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-prim, template-haskell
API changes (from Hackage documentation)
Files
- Data/Aeson/Types/FromJSON.hs +3/−0
- Data/Aeson/Types/Internal.hs +4/−2
- Data/Aeson/Types/ToJSON.hs +3/−0
- aeson.cabal +3/−3
- changelog.md +6/−0
- tests/PropertyKeys.hs +2/−0
- tests/UnitTests.hs +2/−0
Data/Aeson/Types/FromJSON.hs view
@@ -1459,6 +1459,9 @@ {-# INLINE parseJSON #-} parseJSON = fmap Const . parseJSON +instance (FromJSON a, FromJSONKey a) => FromJSONKey (Const a b) where+ fromJSONKey = fmap Const fromJSONKey+ instance FromJSON1 Maybe where liftParseJSON _ _ Null = pure Nothing
Data/Aeson/Types/Internal.hs view
@@ -366,7 +366,7 @@ -- | ----- The ordering is total, consistent with 'Eq' innstance.+-- The ordering is total, consistent with 'Eq' instance. -- However, nothing else about the ordering is specified, -- and it may change from environment to environment and version to version -- of either this package or its dependencies ('hashable' and 'unordered-containers').@@ -426,7 +426,9 @@ where a' = V.toList a lift (Object o) = [| Object (H.fromList . map (first pack) $ o') |] where o' = map (first unpack) . H.toList $ o-#if MIN_VERSION_template_haskell(2,16,0)+#if MIN_VERSION_template_haskell(2,17,0)+ liftTyped = TH.unsafeCodeCoerce . TH.lift+#elif MIN_VERSION_template_haskell(2,16,0) liftTyped = TH.unsafeTExpCoerce . TH.lift #endif
Data/Aeson/Types/ToJSON.hs view
@@ -1234,6 +1234,9 @@ toEncoding (Const x) = toEncoding x {-# INLINE toEncoding #-} +instance (ToJSON a, ToJSONKey a) => ToJSONKey (Const a b) where+ toJSONKey = contramap getConst toJSONKey+ instance ToJSON1 Maybe where liftToJSON t _ (Just a) = t a
aeson.cabal view
@@ -1,5 +1,5 @@ name: aeson-version: 1.5.3.0+version: 1.5.4.0 license: BSD3 license-file: LICENSE category: Text, Web, JSON@@ -103,8 +103,8 @@ bytestring >= 0.10.4.0 && < 0.11, containers >= 0.5.5.1 && < 0.7, deepseq >= 1.3.0.0 && < 1.5,- ghc-prim >= 0.2 && < 0.7,- template-haskell >= 2.9.0.0 && < 2.17,+ ghc-prim >= 0.2 && < 0.8,+ template-haskell >= 2.9.0.0 && < 2.18, text >= 1.2.3.0 && < 1.3, time >= 1.4 && < 1.11
changelog.md view
@@ -1,5 +1,11 @@ For the latest version of this document, please see [https://github.com/bos/aeson/blob/master/changelog.md](https://github.com/bos/aeson/blob/master/changelog.md). +### 1.5.4.0++* Add instances for `ToJSONKey` and `FromJSONKey` to `Const`, thanks to Dan Fithian.+* Add support for template-haskell 2.17, thanks to Galen Huntington.+* Documentation typo fix, thanks to Jean-Baptiste Mazon.+ ### 1.5.3.0 * Add instances for types in `strict` and `data-fix` packages, thanks to Oleg Grenrus.
tests/PropertyKeys.hs view
@@ -4,6 +4,7 @@ import Prelude.Compat +import Control.Applicative (Const) import Data.Time (Day, LocalTime, TimeOfDay, UTCTime) import Data.Version (Version) import Instances ()@@ -37,4 +38,5 @@ , testProperty "Version" $ roundTripKey (undefined :: Version) , testProperty "Lazy Text" $ roundTripKey (undefined :: LT.Text) , testProperty "UUID" $ roundTripKey UUID.nil+ , testProperty "Const Text" $ roundTripKey (undefined :: Const T.Text ()) ]
tests/UnitTests.hs view
@@ -24,6 +24,7 @@ import Prelude.Compat +import Control.Applicative (Const) import Control.Monad (forM, forM_) import Data.Aeson ((.=), (.:), (.:?), (.:!), FromJSON(..), FromJSONKeyFunction(..), FromJSONKey(..), ToJSON1(..), decode, eitherDecode, encode, fromJSON, genericParseJSON, genericToEncoding, genericToJSON, object, withObject, withEmbeddedJSON) import Data.Aeson.Internal (JSONPathElement(..), formatError)@@ -346,6 +347,7 @@ #if __GLASGOW_HASKELL__ >= 710 , assertIsCoerce' "MyText'" (fromJSONKey :: FromJSONKeyFunction MyText')+ , assertIsCoerce "Const Text" (fromJSONKey :: FromJSONKeyFunction (Const Text ())) #endif ] where