aeson-generic-compat 0.0.1.3 → 0.0.2.0
raw patch · 2 files changed
+42/−5 lines, 2 filesdep +textdep +unordered-containersdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependencies added: text, unordered-containers
Dependency ranges changed: aeson
API changes (from Hackage documentation)
+ Data.Aeson.Generic.Compat: objectKeys :: Object -> [Text]
Files
aeson-generic-compat.cabal view
@@ -1,17 +1,24 @@ name: aeson-generic-compat-version: 0.0.1.3+version: 0.0.2.0 synopsis: Compatible generic class names of Aeson description: This package includes compatible generic class names of Aeson package. license: BSD3 license-file: LICENSE author: Kei Hibino maintainer: ex8k.hibino@gmail.com-copyright: Copyright (c) 2016-2018 Kei Hibino+copyright: Copyright (c) 2016-2022 Kei Hibino category: Text build-type: Simple -- extra-source-files: cabal-version: >=1.10-tested-with: GHC == 8.4.1, GHC == 8.4.2, GHC == 8.4.3+tested-with: GHC == 9.6.2+ , GHC == 9.4.6+ , GHC == 9.2.8+ , GHC == 9.0.1, GHC == 9.0.2+ , GHC == 8.10.1, GHC == 8.10.2, GHC == 8.10.3, GHC == 8.10.4+ , GHC == 8.8.1, GHC == 8.8.2, GHC == 8.8.3, GHC == 8.8.4+ , GHC == 8.6.1, GHC == 8.6.2, GHC == 8.6.3+ , GHC == 8.4.1, GHC == 8.4.2, GHC == 8.4.3 , GHC == 8.2.1, GHC == 8.2.2 , GHC == 8.0.1, GHC == 8.0.2 , GHC == 7.10.1, GHC == 7.10.2, GHC == 7.10.3@@ -19,13 +26,25 @@ , GHC == 7.6.1, GHC == 7.6.2, GHC == 7.6.3 , GHC == 7.4.1, GHC == 7.4.2 +flag aeson1+ description: If true, use aeson 1.* or older, otherwise use aeson 2.* or newer+ default: False+ library exposed-modules: Data.Aeson.Generic.Compat -- other-modules: -- other-extensions: build-depends: base <5- , aeson >=0.7+ , text++ if flag(aeson1)+ build-depends:+ aeson >=0.7 && <2+ , unordered-containers+ else+ build-depends:+ aeson >=2 hs-source-dirs: src default-language: Haskell2010
src/Data/Aeson/Generic/Compat.hs view
@@ -2,10 +2,20 @@ {-# LANGUAGE ConstraintKinds #-} module Data.Aeson.Generic.Compat (+ objectKeys, GFromJSON0, GToJSON0, ) where -import Data.Aeson (GFromJSON, GToJSON)+import Data.Text (Text)++#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key as Key+import qualified Data.Aeson.KeyMap as KeyMap+#else+import qualified Data.HashMap.Strict as HashMap+#endif++import Data.Aeson (Object, GFromJSON, GToJSON) #if MIN_VERSION_aeson(1,0,0) import Data.Aeson (Zero) #endif@@ -17,4 +27,12 @@ #else type GFromJSON0 = GFromJSON type GToJSON0 = GToJSON+#endif++objectKeys :: Object -> [Text]+objectKeys =+#if MIN_VERSION_aeson(2,0,0)+ map Key.toText . KeyMap.keys+#else+ HashMap.keys #endif