lens-aeson 1.2.1 → 1.2.2
raw patch · 3 files changed
+23/−6 lines, 3 files
Files
- CHANGELOG.markdown +5/−1
- lens-aeson.cabal +4/−4
- src/Data/Aeson/Lens.hs +14/−1
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+1.2.2 [2022.08.11]+------------------+* Add `atKey :: AsValue t => Key -> Traversal' t (Maybe Value)`, a variant of+ `key` that uses `at` instead of `ix`.+ 1.2.1 [2022.05.07] ------------------ * Change the `IsKey` instances for `ByteString`s to use@@ -105,4 +110,3 @@ 0.1 --- * Repository initialized-
lens-aeson.cabal view
@@ -1,6 +1,6 @@ name: lens-aeson-category: Numeric-version: 1.2.1+category: Data, JSON, Lenses+version: 1.2.2 license: MIT cabal-version: >= 1.10 license-file: LICENSE@@ -42,11 +42,11 @@ lens >= 5.0 && < 6, text >= 0.11.1.10 && < 2.1, text-short >= 0.1.4 && < 0.2,- vector >= 0.9 && < 0.13,+ vector >= 0.9 && < 0.14, unordered-containers >= 0.2.3 && < 0.3, attoparsec >= 0.10 && < 0.15, bytestring >= 0.9 && < 0.12,- aeson >= 2.0.2 && < 2.1,+ aeson >= 2.0.2 && < 2.2, scientific >= 0.3.2 && < 0.4 exposed-modules:
src/Data/Aeson/Lens.hs view
@@ -28,7 +28,7 @@ , nonNull -- * Objects and Arrays , AsValue(..)- , key, members+ , key, atKey, members , nth, values , IsKey(..) -- * Decoding@@ -274,6 +274,19 @@ key :: AsValue t => Key -> Traversal' t Value key i = _Object . ix i {-# INLINE key #-}++-- |+-- Like 'key', but uses 'at' instead of 'ix'. This is handy when+-- adding and removing object keys:+--+-- >>> "{\"a\": 100, \"b\": 200}" & atKey "a" .~ Nothing+-- "{\"b\":200}"+--+-- >>> "{\"a\": 100, \"b\": 200}" & atKey "c" ?~ String "300"+-- "{\"a\":100,\"b\":200,\"c\":\"300\"}"+atKey :: AsValue t => Key -> Traversal' t (Maybe Value)+atKey i = _Object . at i+{-# INLINE atKey #-} -- | An indexed Traversal into Object properties --