aeson-pretty 0.3.1 → 0.4.0
raw patch · 3 files changed
+25/−26 lines, 3 filesdep +unordered-containersdep ~aesondep ~attoparsecdep ~blaze-builderPVP ok
version bump matches the API change (PVP)
Dependencies added: unordered-containers
Dependency ranges changed: aeson, attoparsec, blaze-builder, text, vector
API changes (from Hackage documentation)
Files
- Data/Aeson/Encode/Pretty.hs +4/−4
- Main.hs +8/−9
- aeson-pretty.cabal +13/−13
Data/Aeson/Encode/Pretty.hs view
@@ -8,11 +8,11 @@ import Data.Aeson (Value(..), ToJSON(..)) import qualified Data.Aeson.Encode as Aeson import Data.ByteString.Lazy (ByteString)+import qualified Data.HashMap.Strict as H (toList) import Data.List (intersperse)-import Data.Map (assocs) import Data.Monoid (mappend, mconcat, mempty) import Data.Text (Text)-import Data.Vector (toList)+import qualified Data.Vector as V (toList) type Indent = Int@@ -25,8 +25,8 @@ fromValue :: Indent -> Value -> Builder fromValue ind = go where- go (Array v) = fromCompound ind ('[',']') fromValue (toList v)- go (Object v) = fromCompound ind ('{','}') fromPair (assocs v)+ go (Array v) = fromCompound ind ('[',']') fromValue (V.toList v)+ go (Object m) = fromCompound ind ('{','}') fromPair (H.toList m) go v = Aeson.fromValue v fromCompound :: Indent
Main.hs view
@@ -1,12 +1,11 @@ {-# LANGUAGE DeriveDataTypeable, RecordWildCards, OverloadedStrings #-} module Main (main) where -import Prelude hiding (interact, concat)-import Data.Aeson (Value(..), json, encode)+import Prelude hiding (interact, concat, unlines, null)+import Data.Aeson (Value(..), json', encode) import Data.Aeson.Encode.Pretty (encodePretty) import Data.Attoparsec.Lazy (Result(..), parse)-import Data.ByteString.Lazy (ByteString, interact, concat, append)-import qualified Data.ByteString.Lazy as L (null)+import Data.ByteString.Lazy.Char8 (ByteString, interact, unlines, null) import Data.Version (showVersion) import Paths_aeson_pretty (version) import System.Console.CmdArgs@@ -39,11 +38,11 @@ main = do Opts{..} <- cmdArgs opts let enc = if compact then encode else encodePretty- interact $ concat . map ((`append` "\n") . enc) . values+ interact $ unlines . map enc . values values :: ByteString -> [Value]-values s = case parse json s of- Done rest v -> v : values rest+values s = case parse json' s of+ Done rest v -> v : values rest Fail rest _ _- | L.null rest -> []- | otherwise -> error "invalid json"+ | null rest -> []+ | otherwise -> error "invalid json"
aeson-pretty.cabal view
@@ -1,5 +1,5 @@ name: aeson-pretty-version: 0.3.1+version: 0.4.0 license: BSD3 license-file: LICENSE category: Text, Web, JSON, Pretty Printer@@ -43,15 +43,16 @@ buildable: False else build-depends:- aeson == 0.3.2.*,- attoparsec >= 0.9.1,+ aeson == 0.4.0.*,+ attoparsec == 0.10.*, base == 4.*,- blaze-builder >= 0.3,+ blaze-builder == 0.3.*, bytestring == 0.9.*, cmdargs == 0.7.*, containers,- vector >= 0.7,- text+ vector == 0.9,+ text == 0.11.*,+ unordered-containers >= 0.1.3.0 ghc-options: -Wall ghc-prof-options: -auto-all@@ -60,17 +61,16 @@ exposed-modules: Data.Aeson.Encode.Pretty - other-modules:- build-depends:- aeson == 0.3.2.*,- attoparsec >= 0.9.1,+ aeson == 0.4.0.*,+ attoparsec == 0.10.*, base == 4.*,- blaze-builder >= 0.3,+ blaze-builder == 0.3.*, bytestring == 0.9.*, containers,- vector >= 0.7,- text+ vector == 0.9,+ text == 0.11.*,+ unordered-containers >= 0.1.3.0 ghc-options: -Wall