aeson-pretty 0.1 → 0.2
raw patch · 2 files changed
+36/−25 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/Aeson/Encode/Pretty.hs +8/−8
- aeson-pretty.cabal +28/−17
Data/Aeson/Encode/Pretty.hs view
@@ -25,16 +25,16 @@ fromValue :: Indent -> Value -> Builder fromValue lvl = go where- go (Array v) = renderCompound lvl ('[',']') renderListItem (toList v)- go (Object v) = renderCompound lvl ('{','}') renderPair (assocs v)+ go (Array v) = fromCompound lvl ('[',']') fromListItem (toList v)+ go (Object v) = fromCompound lvl ('{','}') fromPair (assocs v) go v = Aeson.fromValue v -renderCompound :: Indent+fromCompound :: Indent -> (Char, Char) -> (Indent -> a -> Builder) -> [a] -> Builder-renderCompound lvl (delimL,delimR) render content = +fromCompound lvl (delimL,delimR) render content = fromChar delimL `mappend` content' `mappend` fromChar delimR where content' = if null content then mempty@@ -47,11 +47,11 @@ ] newLine = fromChar '\n' -renderListItem :: Indent -> Value -> Builder-renderListItem lvl v = indent lvl `mappend` fromValue lvl v+fromListItem :: Indent -> Value -> Builder+fromListItem lvl v = indent lvl `mappend` fromValue lvl v -renderPair :: Indent -> (Text, Value) -> Builder-renderPair lvl (k,v) =+fromPair :: Indent -> (Text, Value) -> Builder+fromPair lvl (k,v) = mconcat [ indent lvl , Aeson.fromValue (toJSON k) , fromByteString ": "
aeson-pretty.cabal view
@@ -1,5 +1,5 @@ name: aeson-pretty-version: 0.1+version: 0.2 license: BSD3 license-file: LICENSE category: Text, Web, JSON@@ -17,30 +17,41 @@ A JSON pretty-printing library compatible with aeson as well as a command-line tool to improve readabilty of streams of JSON data. .- The library provides a single function "encodePretty". It is a drop-in- replacement for aeson's "encode" function, producing JSON-ByteStrings for - human readers.+ * The library provides a single function "encodePretty". It is a drop-in+ replacement for aeson's "encode" function, producing JSON-ByteStrings+ for human readers. .- The command-line tool reads JSON from stdin and writes prettified JSON- to stdout. It also offers a complementary "compact"-mode, essentially the- opposite of pretty-printing.+ * The command-line tool reads JSON from stdin and writes prettified JSON+ to stdout. It also offers a complementary "compact"-mode, essentially+ the opposite of pretty-printing. If you specify @-flib-only@ like this+ .+ > cabal install -flib-only aeson-pretty+ .+ the command-line tool will NOT be installed. extra-source-files: README.markdown +flag lib-only+ description: Only build/install the library, NOT the command-line tool.+ default: False+ executable aeson-pretty main-is: Main.hs - build-depends:- aeson == 0.3.2.*,- attoparsec >= 0.8.6.1,- base == 4.*,- blaze-builder >= 0.2.1.4,- bytestring == 0.9.*,- cmdargs == 0.7.*,- containers,- vector >= 0.7,- text+ if flag(lib-only)+ buildable: False+ else+ build-depends:+ aeson == 0.3.2.*,+ attoparsec >= 0.8.6.1,+ base == 4.*,+ blaze-builder >= 0.2.1.4,+ bytestring == 0.9.*,+ cmdargs == 0.7.*,+ containers,+ vector >= 0.7,+ text ghc-options: -Wall ghc-prof-options: -auto-all