Hello community,

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

Package is "ghc-aeson-compat"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-aeson-compat/ghc-aeson-compat.changes        
2016-05-17 17:14:26.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-aeson-compat.new/ghc-aeson-compat.changes   
2016-06-07 23:48:16.000000000 +0200
@@ -1,0 +2,6 @@
+Sat Jun  4 14:07:50 UTC 2016 - [email protected]
+
+- update to 0.3.4.0
+* Add NominalDiffTime instances
+
+-------------------------------------------------------------------

Old:
----
  aeson-compat-0.3.3.0.tar.gz

New:
----
  aeson-compat-0.3.4.0.tar.gz

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

Other differences:
------------------
++++++ ghc-aeson-compat.spec ++++++
--- /var/tmp/diff_new_pack.moz8nl/_old  2016-06-07 23:48:16.000000000 +0200
+++ /var/tmp/diff_new_pack.moz8nl/_new  2016-06-07 23:48:16.000000000 +0200
@@ -20,7 +20,7 @@
 %bcond_with tests
 
 Name:           ghc-aeson-compat
-Version:        0.3.3.0
+Version:        0.3.4.0
 Release:        0
 Summary:        Compatibility layer for aeson
 Group:          System/Libraries

++++++ aeson-compat-0.3.3.0.tar.gz -> aeson-compat-0.3.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-compat-0.3.3.0/CHANGELOG.md 
new/aeson-compat-0.3.4.0/CHANGELOG.md
--- old/aeson-compat-0.3.3.0/CHANGELOG.md       2016-05-02 07:08:44.000000000 
+0200
+++ new/aeson-compat-0.3.4.0/CHANGELOG.md       2016-06-03 17:14:54.000000000 
+0200
@@ -1,3 +1,7 @@
+# 0.3.4.0
+
+- Add `NominalDiffTime` instances
+
 # 0.3.3.0
 
 - Enable `PolyKinds` to generalize `Proxy`, `Tagged`, and `Const` instances.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-compat-0.3.3.0/aeson-compat.cabal 
new/aeson-compat-0.3.4.0/aeson-compat.cabal
--- old/aeson-compat-0.3.3.0/aeson-compat.cabal 2016-05-02 07:08:44.000000000 
+0200
+++ new/aeson-compat-0.3.4.0/aeson-compat.cabal 2016-06-03 17:14:54.000000000 
+0200
@@ -1,9 +1,9 @@
--- This file has been generated from package.yaml by hpack version 0.13.0.
+-- This file has been generated from package.yaml by hpack version 0.14.0.
 --
 -- see: https://github.com/sol/hpack
 
 name:           aeson-compat
-version:        0.3.3.0
+version:        0.3.4.0
 synopsis:       Compatibility layer for aeson
 description:    Compatibility layer for @aeson@
 category:       Web
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-compat-0.3.3.0/src/Data/Aeson/Compat.hs 
new/aeson-compat-0.3.4.0/src/Data/Aeson/Compat.hs
--- old/aeson-compat-0.3.3.0/src/Data/Aeson/Compat.hs   2016-05-02 
07:08:44.000000000 +0200
+++ new/aeson-compat-0.3.4.0/src/Data/Aeson/Compat.hs   2016-06-03 
17:14:54.000000000 +0200
@@ -61,7 +61,7 @@
 import           Data.Typeable (Typeable)
 
 #if !MIN_VERSION_aeson(0,10,0)
-import           Data.Time (Day, LocalTime, formatTime)
+import           Data.Time (Day, LocalTime, formatTime, NominalDiffTime)
 import           Data.Time.Locale.Compat (defaultTimeLocale)
 import qualified Data.Aeson.Compat.Time as CompatTime
 #endif
@@ -221,6 +221,23 @@
 
 instance ToJSON LocalTime where
   toJSON = toJSON . T.pack . formatTime defaultTimeLocale "%FT%T%Q"
+
+instance ToJSON NominalDiffTime where
+  toJSON = Number . realToFrac
+  {-# INLINE toJSON #-}
+       
+#if MIN_VERSION_aeson(0,10,0)
+  toEncoding = Encoding . E.number . realToFrac
+  {-# INLINE toEncoding #-}
+#endif
+       
+-- | /WARNING:/ Only parse lengths of time from trusted input
+-- since an attacker could easily fill up the memory of the target
+-- system by specifying a scientific number with a big exponent like
+-- @1e1000000000@.
+instance FromJSON NominalDiffTime where
+  parseJSON = withScientific "NominalDiffTime" $ pure . realToFrac
+  {-# INLINE parseJSON #-}
 #endif
 
 -----------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/aeson-compat-0.3.3.0/test/Tests.hs 
new/aeson-compat-0.3.4.0/test/Tests.hs
--- old/aeson-compat-0.3.3.0/test/Tests.hs      2016-03-27 17:28:25.000000000 
+0200
+++ new/aeson-compat-0.3.4.0/test/Tests.hs      2016-06-03 17:14:54.000000000 
+0200
@@ -9,7 +9,7 @@
 import Data.List.NonEmpty        (NonEmpty)
 import Data.Proxy                (Proxy)
 import Data.Tagged               (Tagged)
-import Data.Time                 (Day, LocalTime)
+import Data.Time                 (Day, LocalTime, NominalDiffTime)
 import Data.Version              (Version)
 import Numeric.Natural           (Natural)
 
@@ -37,6 +37,7 @@
     , testProperty "Proxy"     $ roundtrip (undefined :: Proxy Int)
     , testProperty "Tagged"    $ roundtrip (undefined :: Tagged Int Int)
     , testProperty "NonEmpty"  $ roundtrip (undefined :: NonEmpty Int)
+    , testProperty "NominalDiffTime" $ roundtrip (undefined :: NominalDiffTime)
     ]
   ]
 


Reply via email to