Hello community,

here is the log from the commit of package ghc-aeson-pretty for 
openSUSE:Factory checked in at 2016-10-23 12:50:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-aeson-pretty (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-aeson-pretty.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-aeson-pretty"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-aeson-pretty/ghc-aeson-pretty.changes        
2016-07-21 08:01:14.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-aeson-pretty.new/ghc-aeson-pretty.changes   
2016-10-23 12:50:30.000000000 +0200
@@ -1,0 +2,5 @@
+Thu Sep 15 06:46:30 UTC 2016 - [email protected]
+
+- Update to version 0.8.2 revision 0 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  aeson-pretty-0.7.2.tar.gz

New:
----
  aeson-pretty-0.8.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-aeson-pretty.spec ++++++
--- /var/tmp/diff_new_pack.fwtXXE/_old  2016-10-23 12:50:31.000000000 +0200
+++ /var/tmp/diff_new_pack.fwtXXE/_new  2016-10-23 12:50:31.000000000 +0200
@@ -18,26 +18,26 @@
 
 %global pkg_name aeson-pretty
 Name:           ghc-%{pkg_name}
-Version:        0.7.2
+Version:        0.8.2
 Release:        0
 Summary:        JSON pretty-printing library and command-line tool
 License:        BSD-3-Clause
-Group:          System/Libraries
+Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-# Begin cabal-rpm deps:
 BuildRequires:  chrpath
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-aeson-devel
 BuildRequires:  ghc-attoparsec-devel
+BuildRequires:  ghc-base-compat-devel
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-cmdargs-devel
 BuildRequires:  ghc-rpm-macros
+BuildRequires:  ghc-scientific-devel
 BuildRequires:  ghc-text-devel
 BuildRequires:  ghc-unordered-containers-devel
 BuildRequires:  ghc-vector-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
 
 %description
 A JSON pretty-printing library compatible with aeson as well as a command-line
@@ -68,17 +68,13 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
-
 %ghc_fix_dynamic_rpath %{pkg_name}
 
-
 %post devel
 %ghc_pkg_recache
 

++++++ aeson-pretty-0.7.2.tar.gz -> aeson-pretty-0.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-pretty-0.7.2/Data/Aeson/Encode/Pretty.hs 
new/aeson-pretty-0.8.2/Data/Aeson/Encode/Pretty.hs
--- old/aeson-pretty-0.7.2/Data/Aeson/Encode/Pretty.hs  2014-12-05 
21:49:24.000000000 +0100
+++ new/aeson-pretty-0.8.2/Data/Aeson/Encode/Pretty.hs  2016-09-09 
20:18:24.000000000 +0200
@@ -4,18 +4,19 @@
 module Data.Aeson.Encode.Pretty (
     -- * Simple Pretty-Printing
     encodePretty, encodePrettyToTextBuilder,
-    
+
     -- * Pretty-Printing with Configuration Options
     encodePretty', encodePrettyToTextBuilder',
     Config (..), defConfig,
+    Indent(..), NumberFormat(..),
     -- ** Sorting Keys in Objects
-    -- |With the Aeson library, the order of keys in objects is undefined due
+    -- |With the Aeson library, the order of keys in objects is undefined due 
to
     --  objects being implemented as HashMaps. To allow user-specified key
     --  orders in the pretty-printed JSON, 'encodePretty'' can be configured
     --  with a comparison function. These comparison functions can be composed
     --  using the 'Monoid' interface. Some other useful helper functions to 
keep
     --  in mind are 'comparing' and 'on'.
-    --  
+    --
     --  Consider the following deliberately convoluted example, demonstrating
     --  the use of comparison functions:
     --
@@ -43,7 +44,7 @@
     --  >   "quux": ...,
     --  > }
     --
-    
+
     mempty,
     -- |Serves as an order-preserving (non-)sort function. Re-exported from
     --  "Data.Monoid".
@@ -60,23 +61,50 @@
 import qualified Data.HashMap.Strict as H (toList)
 import Data.List (intersperse, sortBy, elemIndex)
 import Data.Maybe (fromMaybe)
-import Data.Monoid ((<>), mconcat, mempty)
-import Data.Ord
+import Data.Monoid ((<>))
+import qualified Data.Scientific as S (Scientific, FPFormat(..))
+import Data.Ord (comparing)
 import Data.Text (Text)
 import Data.Text.Lazy.Builder (Builder, toLazyText)
+import Data.Text.Lazy.Builder.Scientific (formatScientificBuilder)
 import Data.Text.Lazy.Encoding (encodeUtf8)
 import qualified Data.Vector as V (toList)
+import Prelude ()
+import Prelude.Compat
 
-data PState = PState { pstIndent :: Int
-                     , pstLevel  :: Int
-                     , pstSort   :: [(Text, Value)] -> [(Text, Value)]
+
+data PState = PState { pLevel     :: Int
+                     , pIndent    :: Builder
+                     , pNewline   :: Builder
+                     , pItemSep   :: Builder
+                     , pKeyValSep :: Builder
+                     , pNumFormat :: NumberFormat
+                     , pSort      :: [(Text, Value)] -> [(Text, Value)]
                      }
 
+-- | Indentation per level of nesting. @'Spaces' 0@ removes __all__ whitespace
+--   from the output.
+data Indent = Spaces Int | Tab
+
+data NumberFormat
+  -- | The standard behaviour of the 'Aeson.encode' function. Uses
+  --   integer literals for integers (1, 2, 3...), simple decimals
+  --   for fractional values between 0.1 and 9,999,999, and scientific
+  --   notation otherwise.
+  = Generic
+  -- | Scientific notation (e.g. 2.3e123).
+  | Scientific
+  -- | Standard decimal notation
+  | Decimal
+  -- | Custom formatting function
+  | Custom (S.Scientific -> Builder)
+
 data Config = Config
-    { confIndent  :: Int
-      -- ^ Indentation spaces per level of nesting
+    { confIndent  :: Indent
+      -- ^ Indentation per level of nesting
     , confCompare :: Text -> Text -> Ordering
       -- ^ Function used to sort keys in objects
+    , confNumFormat :: NumberFormat
     }
 
 -- |Sort keys by their order of appearance in the argument list.
@@ -92,11 +120,12 @@
 -- |The default configuration: indent by four spaces per level of nesting, do
 --  not sort objects by key.
 --
---  > defConfig = Config { confIndent = 4, confCompare = mempty }
+--  > defConfig = Config { confIndent = 4, confCompare = mempty, confNumFormat 
= Generic }
 defConfig :: Config
-defConfig = Config { confIndent = 4, confCompare = mempty }
+defConfig =
+  Config {confIndent = Spaces 4, confCompare = mempty, confNumFormat = Generic}
 
--- |A drop-in replacement for aeson's 'Aeson.encode' function, producing 
+-- |A drop-in replacement for aeson's 'Aeson.encode' function, producing
 --  JSON-ByteStrings for human readers.
 --
 --  Follows the default configuration in 'defConfig'.
@@ -120,15 +149,26 @@
 encodePrettyToTextBuilder' :: ToJSON a => Config -> a -> Builder
 encodePrettyToTextBuilder' Config{..} = fromValue st . toJSON
   where
-    st       = PState confIndent 0 condSort
-    condSort = sortBy (confCompare `on` fst)
+    st      = PState 0 indent newline itemSep kvSep confNumFormat sortFn
+    indent  = case confIndent of
+                Spaces n -> mconcat (replicate n " ")
+                Tab      -> "\t"
+    newline = case confIndent of
+                Spaces 0 -> ""
+                _        -> "\n"
+    itemSep = ","
+    kvSep   = case confIndent of
+                Spaces 0 -> ":"
+                _        -> ": "
+    sortFn  = sortBy (confCompare `on` fst)
 
 
 fromValue :: PState -> Value -> Builder
 fromValue st@PState{..} = go
   where
     go (Array v)  = fromCompound st ("[","]") fromValue (V.toList v)
-    go (Object m) = fromCompound st ("{","}") fromPair (pstSort (H.toList m))
+    go (Object m) = fromCompound st ("{","}") fromPair (pSort (H.toList m))
+    go (Number x) = fromNumber st x
     go v          = Aeson.encodeToTextBuilder v
 
 fromCompound :: PState
@@ -139,17 +179,25 @@
 fromCompound st@PState{..} (delimL,delimR) fromItem items = mconcat
     [ delimL
     , if null items then mempty
-        else "\n" <> items' <> "\n" <> fromIndent st
+        else pNewline <> items' <> pNewline <> fromIndent st
     , delimR
     ]
   where
-    items' = mconcat . intersperse ",\n" $
+    items' = mconcat . intersperse (pItemSep <> pNewline) $
                 map (\item -> fromIndent st' <> fromItem st' item)
                     items
-    st' = st { pstLevel = pstLevel + 1 }
+    st' = st { pLevel = pLevel + 1 }
 
 fromPair :: PState -> (Text, Value) -> Builder
-fromPair st (k,v) = Aeson.encodeToTextBuilder (toJSON k) <> ": " <> fromValue 
st v
+fromPair st (k,v) =
+  Aeson.encodeToTextBuilder (toJSON k) <> pKeyValSep st <> fromValue st v
 
 fromIndent :: PState -> Builder
-fromIndent PState{..} = mconcat $ replicate (pstIndent * pstLevel) " "
+fromIndent PState{..} = mconcat (replicate pLevel pIndent)
+
+fromNumber :: PState -> S.Scientific -> Builder
+fromNumber st x = case pNumFormat st of
+  Generic    -> Aeson.encodeToTextBuilder $ Number x
+  Scientific -> formatScientificBuilder S.Exponent Nothing x
+  Decimal    -> formatScientificBuilder S.Fixed Nothing x
+  Custom f   -> f x
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-pretty-0.7.2/README.markdown 
new/aeson-pretty-0.8.2/README.markdown
--- old/aeson-pretty-0.7.2/README.markdown      2014-12-05 21:49:24.000000000 
+0100
+++ new/aeson-pretty-0.8.2/README.markdown      2016-07-01 15:55:09.000000000 
+0200
@@ -1,5 +1,7 @@
 # Welcome to aeson-pretty
 
+[![Build 
Status](https://travis-ci.org/informatikr/aeson-pretty.svg?branch=master)](https://travis-ci.org/informatikr/aeson-pretty)
+
 This is a JSON pretty-printing Haskell library compatible with 
[aeson](http://hackage.haskell.org/package/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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-pretty-0.7.2/aeson-pretty.cabal 
new/aeson-pretty-0.8.2/aeson-pretty.cabal
--- old/aeson-pretty-0.7.2/aeson-pretty.cabal   2014-12-05 21:49:24.000000000 
+0100
+++ new/aeson-pretty-0.8.2/aeson-pretty.cabal   2016-09-09 20:19:04.000000000 
+0200
@@ -1,5 +1,5 @@
 name:           aeson-pretty
-version:        0.7.2
+version:        0.8.2
 license:        BSD3
 license-file:   LICENSE
 category:       Text, Web, JSON, Pretty Printer
@@ -42,7 +42,9 @@
     build-depends:
         aeson >= 0.7,
         base >= 4.5,
+        base-compat >= 0.9 && < 0.10,
         bytestring >= 0.9,
+        scientific >= 0.3,
         vector >= 0.9,
         text >= 0.11,
         unordered-containers >= 0.1.3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-pretty-0.7.2/cli-tool/Main.hs 
new/aeson-pretty-0.8.2/cli-tool/Main.hs
--- old/aeson-pretty-0.7.2/cli-tool/Main.hs     2014-12-05 21:49:24.000000000 
+0100
+++ new/aeson-pretty-0.8.2/cli-tool/Main.hs     2016-06-30 20:43:17.000000000 
+0200
@@ -44,8 +44,9 @@
 main :: IO ()
 main = do
     Opts{..} <- cmdArgs opts
-    let conf = Config { confIndent  = indent
-                      , confCompare = if sort then compare else mempty
+    let conf = Config { confIndent    = Spaces indent
+                      , confCompare   = if sort then compare else mempty
+                      , confNumFormat = Generic
                       }
         enc = if compact then encode else encodePretty' conf
     interact $ unlines . map enc . values


Reply via email to