packages feed

aeson-optics 1.1.0.1 → 1.1.1

raw patch · 3 files changed

+44/−10 lines, 3 filesdep ~aesondep ~basedep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson, base, text

API changes (from Hackage documentation)

+ Data.Aeson.Optics: instance Optics.At.Core.At (Data.Aeson.KeyMap.KeyMap v)
+ Data.Aeson.Optics: instance Optics.At.Core.Ixed (Data.Aeson.KeyMap.KeyMap v)
+ Data.Aeson.Optics: instance Optics.Each.Core.Each Data.Aeson.Key.Key (Data.Aeson.KeyMap.KeyMap a) (Data.Aeson.KeyMap.KeyMap b) a b

Files

+ CHANGELOG.md view
@@ -0,0 +1,3 @@+# 1.1.1++- Support `aeson-2.0.0.0`: add instances for `KeyMap`.
aeson-optics.cabal view
@@ -1,4 +1,4 @@-version:            1.1.0.1+version:            1.1.1 name:               aeson-optics category:           Data, JSON, Optics license:            MIT@@ -15,12 +15,15 @@   Copyright (C) 2019 Oleg Grenrus  build-type:         Simple-tested-with:        GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1+tested-with:+  GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4 || ==9.0.1+ synopsis:           Law-abiding optics for aeson description:        Law-abiding optics for aeson. extra-source-files:   AUTHORS.markdown   README.markdown+  CHANGELOG.md  source-repository head   type:     git@@ -29,13 +32,13 @@ library   default-language: Haskell2010   build-depends:-      aeson                 >=0.11     && <1.5-    , attoparsec            >=0.13.1.0 && <0.14-    , base                  >=4.9      && <5-    , base-compat           >=0.9.3    && <0.12-    , bytestring            >=0.10.8.1 && <0.11-    , optics-core           >=0.1      && <0.2-    , optics-extra          >=0.1      && <1.1+      aeson                 >=0.11     && <1.6 || >=2.0 && <2.1+    , attoparsec            >=0.13.1.0 && <0.15+    , base                  >=4.9      && <4.16+    , base-compat           >=0.9.3    && <0.13+    , bytestring            >=0.10.8.1 && <0.12+    , optics-core           >=0.1      && <0.5+    , optics-extra          >=0.1      && <0.5     , scientific            >=0.3.4.9  && <0.4     , text                  >=1.2.2.0  && <1.3     , unordered-containers  >=0.2.8.0  && <0.3
src/Data/Aeson/Optics.hs view
@@ -77,6 +77,11 @@ import qualified Data.Text.Lazy          as LazyText import qualified Data.Text.Lazy.Encoding as LazyText +#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key    as Key+import qualified Data.Aeson.KeyMap as KM+#endif+ -- $setup -- >>> import Data.ByteString.Char8 as Strict.Char8 -- >>> import qualified Data.Vector as Vector@@ -299,7 +304,15 @@   -- >>> _Object # HashMap.fromList [("key", _String # "value")] :: String   -- "{\"key\":\"value\"}"   _Object :: Prism' t (HashMap Text Value)-  _Object = _Value%prism Object (\v -> case v of Object o -> Right o; _ -> Left v)+  _Object = _Value%prism (Object . fwd) (\v -> case v of Object o -> Right (bwd o); _ -> Left v)+    where+#if MIN_VERSION_aeson(2,0,0)+    fwd = KM.fromHashMapText+    bwd = KM.toHashMapText+#else+    fwd = id+    bwd = id+#endif   {-# INLINE _Object #-}    -- |@@ -481,6 +494,21 @@   plate _ xs = pure xs   {-# INLINE plate #-} -}++#if MIN_VERSION_aeson(2,0,0)+type instance Index (KM.KeyMap v) = Key.Key+type instance IxValue (KM.KeyMap v) = v++instance Ixed (KM.KeyMap v)++instance At (KM.KeyMap v) where+  at i = lensVL (\f -> KM.alterF f i)+  {-# INLINE at #-}++instance Each Key.Key (KM.KeyMap a) (KM.KeyMap b) a b where+  each = itraversalVL KM.traverseWithKey+  {-# INLINE[1] each #-}+#endif  ------------------------------------------------------------------------------ -- Pattern Synonyms