Hello community,

here is the log from the commit of package ghc-extra for openSUSE:Factory 
checked in at 2019-08-24 18:44:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-extra (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-extra.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-extra"

Sat Aug 24 18:44:13 2019 rev:22 rq:725519 version:1.6.18

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-extra/ghc-extra.changes      2019-06-12 
13:18:38.368569734 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-extra.new.7948/ghc-extra.changes    
2019-08-24 18:44:13.301769949 +0200
@@ -1,0 +2,8 @@
+Thu Aug 22 02:02:21 UTC 2019 - psim...@suse.com
+
+- Update extra to version 1.6.18.
+  1.6.18, released 2019-08-21
+      Make errorIO include a call stack
+      Make maximumOn and minimumOn apply the function once per element
+
+-------------------------------------------------------------------

Old:
----
  extra-1.6.17.tar.gz

New:
----
  extra-1.6.18.tar.gz

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

Other differences:
------------------
++++++ ghc-extra.spec ++++++
--- /var/tmp/diff_new_pack.9e6PeI/_old  2019-08-24 18:44:13.865769895 +0200
+++ /var/tmp/diff_new_pack.9e6PeI/_new  2019-08-24 18:44:13.865769895 +0200
@@ -19,7 +19,7 @@
 %global pkg_name extra
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        1.6.17
+Version:        1.6.18
 Release:        0
 Summary:        Extra functions I use
 License:        BSD-3-Clause

++++++ extra-1.6.17.tar.gz -> extra-1.6.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/extra-1.6.17/CHANGES.txt new/extra-1.6.18/CHANGES.txt
--- old/extra-1.6.17/CHANGES.txt        2019-05-31 23:19:21.000000000 +0200
+++ new/extra-1.6.18/CHANGES.txt        2019-08-21 14:58:59.000000000 +0200
@@ -1,5 +1,8 @@
 Changelog for Extra
 
+1.6.18, released 2019-08-21
+    Make errorIO include a call stack
+    Make maximumOn and minimumOn apply the function once per element
 1.6.17, released 2019-05-31
     Add enumerate
 1.6.16, released 2019-05-25
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/extra-1.6.17/extra.cabal new/extra-1.6.18/extra.cabal
--- old/extra-1.6.17/extra.cabal        2019-05-31 23:19:32.000000000 +0200
+++ new/extra-1.6.18/extra.cabal        2019-08-21 14:59:07.000000000 +0200
@@ -1,7 +1,7 @@
 cabal-version:      >= 1.18
 build-type:         Simple
 name:               extra
-version:            1.6.17
+version:            1.6.18
 license:            BSD3
 license-file:       LICENSE
 category:           Development
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/extra-1.6.17/src/Control/Exception/Extra.hs 
new/extra-1.6.18/src/Control/Exception/Extra.hs
--- old/extra-1.6.17/src/Control/Exception/Extra.hs     2019-02-25 
16:56:30.000000000 +0100
+++ new/extra-1.6.18/src/Control/Exception/Extra.hs     2019-08-21 
16:07:02.000000000 +0200
@@ -21,6 +21,10 @@
     catchBool, handleBool, tryBool
     ) where
 
+#if __GLASGOW_HASKELL__ >= 800
+import GHC.Stack
+#endif
+
 import Control.Exception
 import Control.Monad
 import Data.List.Extra
@@ -68,11 +72,16 @@
 
 
 -- | Like error, but in the 'IO' monad.
---   Note that while 'fail' in 'IO' raises an 'IOException', this function 
raises an 'ErrorCall' exception.
+--   Note that while 'fail' in 'IO' raises an 'IOException', this function 
raises an 'ErrorCall' exception with a call stack.
 --
--- > try (errorIO "Hello") == return (Left (ErrorCall "Hello"))
+-- > catch (errorIO "Hello") (\(ErrorCall x) -> return x) == return "Hello"
 errorIO :: Partial => String -> IO a
-errorIO = throwIO . ErrorCall
+errorIO x = withFrozenCallStack $ evaluate $ error x
+
+#if __GLASGOW_HASKELL__ < 800
+withFrozenCallStack :: a -> a
+withFrozenCallStack = id
+#endif
 
 
 -- | Retry an operation at most /n/ times (/n/ must be positive).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/extra-1.6.17/src/Data/List/Extra.hs 
new/extra-1.6.18/src/Data/List/Extra.hs
--- old/extra-1.6.17/src/Data/List/Extra.hs     2019-05-31 22:05:33.000000000 
+0200
+++ new/extra-1.6.18/src/Data/List/Extra.hs     2019-06-17 12:23:14.000000000 
+0200
@@ -364,12 +364,33 @@
 nubOn f = map snd . nubBy ((==) `on` fst) . map (\x -> let y = f x in y `seq` 
(y, x))
 
 -- | A version of 'maximum' where the comparison is done on some extracted 
value.
-maximumOn :: Ord b => (a -> b) -> [a] -> a
-maximumOn f = maximumBy (compare `on` f)
+--   Raises an error if the list is empty. Only calls the function once per 
element.
+--
+-- > maximumOn id [] == undefined
+-- > maximumOn length ["test","extra","a"] == "extra"
+maximumOn :: (Partial, Ord b) => (a -> b) -> [a] -> a
+maximumOn f [] = error "Data.List.Extra.maximumOn: empty list"
+maximumOn f (x:xs) = g x (f x) xs
+    where
+        g v mv [] = v
+        g v mv (x:xs) | mx > mv = g x mx xs
+                      | otherwise = g v mv xs
+            where mx = f x
+
 
--- | A version of 'minimum' where the comparison is done on some extracted 
value.
-minimumOn :: Ord b => (a -> b) -> [a] -> a
-minimumOn f = minimumBy (compare `on` f)
+-- | A version of 'maximum' where the comparison is done on some extracted 
value.
+--   Raises an error if the list is empty. Only calls the function once per 
element.
+--
+-- > minimumOn id [] == undefined
+-- > minimumOn length ["test","extra","a"] == "a"
+minimumOn :: (Partial, Ord b) => (a -> b) -> [a] -> a
+minimumOn f [] = error "Data.List.Extra.minimumOn: empty list"
+minimumOn f (x:xs) = g x (f x) xs
+    where
+        g v mv [] = v
+        g v mv (x:xs) | mx < mv = g x mx xs
+                      | otherwise = g v mv xs
+            where mx = f x
 
 -- | A combination of 'group' and 'sort'.
 --
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/extra-1.6.17/test/TestGen.hs 
new/extra-1.6.18/test/TestGen.hs
--- old/extra-1.6.17/test/TestGen.hs    2019-05-31 22:06:00.000000000 +0200
+++ new/extra-1.6.18/test/TestGen.hs    2019-08-21 14:55:18.000000000 +0200
@@ -20,7 +20,7 @@
     testGen "stringException ['t','e','s','t',undefined]      == return 
\"test<Exception>\"" $ stringException ['t','e','s','t',undefined]      == 
return "test<Exception>"
     testGen "ignore (print 1)    == print 1" $ ignore (print 1)    == print 1
     testGen "ignore (fail \"die\") == return ()" $ ignore (fail "die") == 
return ()
-    testGen "try (errorIO \"Hello\") == return (Left (ErrorCall \"Hello\"))" $ 
try (errorIO "Hello") == return (Left (ErrorCall "Hello"))
+    testGen "catch (errorIO \"Hello\") (\\(ErrorCall x) -> return x) == return 
\"Hello\"" $ catch (errorIO "Hello") (\(ErrorCall x) -> return x) == return 
"Hello"
     testGen "retry 1 (print \"x\")  == print \"x\"" $ retry 1 (print "x")  == 
print "x"
     testGen "retry 3 (fail \"die\") == fail \"die\"" $ retry 3 (fail "die") == 
fail "die"
     testGen "whenJust Nothing  print == return ()" $ whenJust Nothing  print 
== return ()
@@ -149,6 +149,10 @@
     testGen "escapeJSON \"\\ttab\\nnewline\\\\\" == 
\"\\\\ttab\\\\nnewline\\\\\\\\\"" $ escapeJSON "\ttab\nnewline\\" == 
"\\ttab\\nnewline\\\\"
     testGen "escapeJSON \"\\ESC[0mHello\" == \"\\\\u001b[0mHello\"" $ 
escapeJSON "\ESC[0mHello" == "\\u001b[0mHello"
     testGen "\\xs -> unescapeJSON (escapeJSON xs) == xs" $ \xs -> unescapeJSON 
(escapeJSON xs) == xs
+    testGen "maximumOn id [] == undefined" $ erroneous $ maximumOn id []
+    testGen "maximumOn length [\"test\",\"extra\",\"a\"] == \"extra\"" $ 
maximumOn length ["test","extra","a"] == "extra"
+    testGen "minimumOn id [] == undefined" $ erroneous $ minimumOn id []
+    testGen "minimumOn length [\"test\",\"extra\",\"a\"] == \"a\"" $ minimumOn 
length ["test","extra","a"] == "a"
     testGen "groupSort [(1,'t'),(3,'t'),(2,'e'),(2,'s')] == 
[(1,\"t\"),(2,\"es\"),(3,\"t\")]" $ groupSort [(1,'t'),(3,'t'),(2,'e'),(2,'s')] 
== [(1,"t"),(2,"es"),(3,"t")]
     testGen "\\xs -> map fst (groupSort xs) == sort (nub (map fst xs))" $ \xs 
-> map fst (groupSort xs) == sort (nub (map fst xs))
     testGen "\\xs -> concatMap snd (groupSort xs) == map snd (sortOn fst xs)" 
$ \xs -> concatMap snd (groupSort xs) == map snd (sortOn fst xs)


Reply via email to