deriving-aeson 0.2.2 → 0.2.3
raw patch · 3 files changed
+15/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- deriving-aeson.cabal +2/−1
- src/Deriving/Aeson.hs +9/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for deriving-aeson +## 0.2.3++* Fixed a bug in `SumTaggedObject`+ ## 0.2.2 * Added `UnwrapUnaryRecords`
deriving-aeson.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: deriving-aeson-version: 0.2.2+version: 0.2.3 synopsis: Type driven generic aeson instance customisation description: This package provides a newtype wrapper with FromJSON/ToJSON instances customisable via a phantom type parameter.@@ -13,6 +13,7 @@ copyright: Copyright (c) 2020 Fumiaki Kinoshita category: JSON, Generics extra-source-files: CHANGELOG.md, README.md+tested-with: GHC == 8.6.5, GHC == 8.8.3 source-repository head type: git
src/Deriving/Aeson.hs view
@@ -72,6 +72,7 @@ -- | the encoding will always follow the 'sumEncoding'. data NoAllNullaryToStringTag +-- | Unpack single-field records data UnwrapUnaryRecords -- | Strip prefix @t@. If it doesn't have the prefix, keep it as-is.@@ -100,9 +101,16 @@ instance StringModifier CamelToSnake where getStringModifier = camelTo2 '_' +-- | @{ "tag": t, "content": c}@ data SumTaggedObject t c++-- | @CONTENT@ data SumUntaggedValue++-- | @{ TAG: CONTENT }@ data SumObjectWithSingleField++-- | @[TAG, CONTENT]@ data SumTwoElemArray -- | Reify 'Options' from a type-level list@@ -131,7 +139,7 @@ aesonOptions = (aesonOptions @xs) { allNullaryToStringTag = False } instance (KnownSymbol t, KnownSymbol c, AesonOptions xs) => AesonOptions (SumTaggedObject t c ': xs) where- aesonOptions = (aesonOptions @xs) { sumEncoding = TaggedObject (symbolVal (Proxy @ t)) (symbolVal (Proxy @ t)) }+ aesonOptions = (aesonOptions @xs) { sumEncoding = TaggedObject (symbolVal (Proxy @ t)) (symbolVal (Proxy @ c)) } instance (AesonOptions xs) => AesonOptions (SumUntaggedValue ': xs) where aesonOptions = (aesonOptions @xs) { sumEncoding = UntaggedValue }