diff options
author | Kierán Meinhardt <kmein@posteo.de> | 2024-10-11 17:12:39 +0200 |
---|---|---|
committer | Kierán Meinhardt <kmein@posteo.de> | 2024-10-11 17:12:39 +0200 |
commit | 56fccc922fd3d7fdf748b7d2b6cf1df4e48bceb2 (patch) | |
tree | d53867adf7c02a8f2e88f3f310ff699ff28b23cf | |
parent | ff448719b9fa0463639440dcdfcca17294a02d83 (diff) |
pretty print JSON
-rw-r--r-- | astore.cabal | 1 | ||||
-rw-r--r-- | src/Store/Query.hs | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/astore.cabal b/astore.cabal index 77b450b..a59eb0f 100644 --- a/astore.cabal +++ b/astore.cabal @@ -32,6 +32,7 @@ library build-depends: aeson, + aeson-pretty, base, bytestring, containers, diff --git a/src/Store/Query.hs b/src/Store/Query.hs index c400206..091aae7 100644 --- a/src/Store/Query.hs +++ b/src/Store/Query.hs @@ -8,6 +8,7 @@ import Control.Arrow (second) import Control.Exception (throw) import Control.Monad.Trans (lift) import Data.Aeson qualified as J +import Data.Aeson.Encode.Pretty qualified as JP import Data.Aeson.Key qualified as JK import Data.Aeson.KeyMap qualified as JM import Data.List (foldl', foldl1') @@ -175,4 +176,4 @@ decodeFile c fn = do encodeFile :: String -> String -> J.Value -> S.StoreM () encodeFile c fn (J.Object kvs) = do let fp = c </> fn - S.writeFile fp (J.encode (J.Object (JM.filterWithKey (\k _ -> k /= "$fileName") kvs))) + S.writeFile fp (JP.encodePretty (J.Object (JM.filterWithKey (\k _ -> k /= "$fileName") kvs))) |