aeson-with 0.1.0.2 → 0.1.1.0
raw patch · 3 files changed
+19/−2 lines, 3 filesdep +mtlPVP ok
version bump matches the API change (PVP)
Dependencies added: mtl
API changes (from Hackage documentation)
+ Data.Aeson.With: toListOf' :: ToJSON a1 => Getting (Endo [a2]) Value a2 -> a1 -> [a2]
+ Data.Aeson.With: view' :: ToJSON a => Getting c Value c -> a -> c
Files
- ChangeLog.md +4/−0
- aeson-with.cabal +6/−2
- src/Data/Aeson/With.hs +9/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for aeson-with +## v0.1.1.0++* Add `view'` and `toListOf'` for viewing `ToJSON` instances.+ ## v0.1.0.0 * Change `withArrayField` and `withValue` to take `ToJSON` values.
aeson-with.cabal view
@@ -1,11 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.2.+-- This file has been generated from package.yaml by hpack version 0.33.1. -- -- see: https://github.com/sol/hpack+--+-- hash: 8f345d1bfb78a90a73a80ab20cde672b7ccde91907731474658cacc53629f432 name: aeson-with-version: 0.1.0.2+version: 0.1.1.0 synopsis: withXField combinators for aeson description: Silly little withXField combinators for adding fields to an existing JSON value. category: Data@@ -30,12 +32,14 @@ Paths_aeson_with hs-source-dirs: src+ ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints build-depends: aeson , base >=4.7 && <5 , hashmap , lens , lens-aeson+ , mtl , scientific , text , unordered-containers
src/Data/Aeson/With.hs view
@@ -8,6 +8,8 @@ , withNumberField , withBoolField , withNullField+, view'+, toListOf' )where import Control.Lens@@ -15,8 +17,15 @@ import Data.Aeson.Lens import qualified Data.HashMap.Lazy as HML import Data.Scientific+import Data.Semigroup import Data.Text import qualified Data.Vector as V++view' :: ToJSON a => Getting c Value c -> a -> c+view' f = view f . toJSON++toListOf' :: ToJSON a1 => Getting (Endo [a2]) Value a2 -> a1 -> [a2]+toListOf' f = toListOf f . toJSON -- | Union two JSON values together. withJSON :: (ToJSON a) => a -> Value -> Value