Hello community, here is the log from the commit of package ghc-extra for openSUSE:Factory checked in at 2020-06-19 17:12:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-extra (Old) and /work/SRC/openSUSE:Factory/.ghc-extra.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-extra" Fri Jun 19 17:12:42 2020 rev:26 rq:815089 version:1.7.3 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-extra/ghc-extra.changes 2020-05-11 13:35:30.720382829 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-extra.new.3606/ghc-extra.changes 2020-06-19 17:12:45.826026437 +0200 @@ -1,0 +2,13 @@ +Tue Jun 9 09:10:56 UTC 2020 - [email protected] + +- Update extra to version 1.7.3. + 1.7.3, released 2020-05-30 + #58, add disjointOrd and disjointOrdBy + 1.7.2, released 2020-05-25 + #56, add zipWithLongest + #57, make duration in MonadIO + Simplify and optimise Barrier + Mark modules that are empty as DEPRECATED + Remove support for GHC 7.10 + +------------------------------------------------------------------- Old: ---- extra-1.7.1.tar.gz New: ---- extra-1.7.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-extra.spec ++++++ --- /var/tmp/diff_new_pack.IVWWnW/_old 2020-06-19 17:12:46.646029181 +0200 +++ /var/tmp/diff_new_pack.IVWWnW/_new 2020-06-19 17:12:46.650029194 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-extra # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name extra %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.7.1 +Version: 1.7.3 Release: 0 Summary: Extra functions I use License: BSD-3-Clause @@ -31,7 +31,6 @@ BuildRequires: ghc-filepath-devel BuildRequires: ghc-process-devel BuildRequires: ghc-rpm-macros -BuildRequires: ghc-semigroups-devel BuildRequires: ghc-time-devel BuildRequires: ghc-unix-devel %if %{with tests} ++++++ extra-1.7.1.tar.gz -> extra-1.7.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/CHANGES.txt new/extra-1.7.3/CHANGES.txt --- old/extra-1.7.1/CHANGES.txt 2020-03-10 23:59:31.000000000 +0100 +++ new/extra-1.7.3/CHANGES.txt 2020-05-31 00:28:28.000000000 +0200 @@ -1,5 +1,13 @@ Changelog for Extra +1.7.3, released 2020-05-30 + #58, add disjointOrd and disjointOrdBy +1.7.2, released 2020-05-25 + #56, add zipWithLongest + #57, make duration in MonadIO + Simplify and optimise Barrier + Mark modules that are empty as DEPRECATED + Remove support for GHC 7.10 1.7.1, released 2020-03-10 Add NOINLINE to errorIO to work around a GHC 8.4 bug 1.7, released 2020-03-05 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/extra.cabal new/extra-1.7.3/extra.cabal --- old/extra-1.7.1/extra.cabal 2020-03-10 23:59:36.000000000 +0100 +++ new/extra-1.7.3/extra.cabal 2020-05-31 00:28:33.000000000 +0200 @@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: extra -version: 1.7.1 +version: 1.7.3 license: BSD3 license-file: LICENSE category: Development @@ -15,7 +15,7 @@ The module "Extra" documents all functions provided by this library. Modules such as "Data.List.Extra" provide extra functions over "Data.List" and also reexport "Data.List". Users are recommended to replace "Data.List" imports with "Data.List.Extra" if they need the extra functionality. homepage: https://github.com/ndmitchell/extra#readme bug-reports: https://github.com/ndmitchell/extra/issues -tested-with: GHC==8.8.1, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3 +tested-with: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2 extra-doc-files: CHANGES.txt @@ -31,13 +31,11 @@ default-language: Haskell2010 hs-source-dirs: src build-depends: - base >= 4.8 && < 5, + base >= 4.9 && < 5, directory, filepath, process, clock >= 0.7, - -- For GHC 7.10 since Data.List.NonEmpty wasn't in base then - semigroups, time if !os(windows) build-depends: unix diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/Control/Concurrent/Extra.hs new/extra-1.7.3/src/Control/Concurrent/Extra.hs --- old/extra-1.7.1/src/Control/Concurrent/Extra.hs 2020-02-28 10:29:17.000000000 +0100 +++ new/extra-1.7.3/src/Control/Concurrent/Extra.hs 2020-05-25 13:50:36.000000000 +0200 @@ -182,38 +182,26 @@ -- for it to complete. A barrier has similarities to a future or promise -- from other languages, has been known as an IVar in other Haskell work, -- and in some ways is like a manually managed thunk. -newtype Barrier a = Barrier (Var (Either (MVar ()) a)) - -- Either a Left empty MVar you should wait or a Right result - -- With base 4.7 and above readMVar is atomic so you probably can implement Barrier directly on MVar a +newtype Barrier a = Barrier (MVar a) -- | Create a new 'Barrier'. newBarrier :: IO (Barrier a) -newBarrier = fmap Barrier $ newVar . Left =<< newEmptyMVar +newBarrier = Barrier <$> newEmptyMVar -- | Write a value into the Barrier, releasing anyone at 'waitBarrier'. -- Any subsequent attempts to signal the 'Barrier' will throw an exception. signalBarrier :: Partial => Barrier a -> a -> IO () -signalBarrier (Barrier var) v = mask_ $ -- use mask so never in an inconsistent state - join $ modifyVar var $ \x -> case x of - Left bar -> pure (Right v, putMVar bar ()) - Right res -> error "Control.Concurrent.Extra.signalBarrier, attempt to signal a barrier that has already been signaled" +signalBarrier (Barrier var) v = do + b <- tryPutMVar var v + unless b $ errorIO "Control.Concurrent.Extra.signalBarrier, attempt to signal a barrier that has already been signaled" -- | Wait until a barrier has been signaled with 'signalBarrier'. waitBarrier :: Barrier a -> IO a -waitBarrier (Barrier var) = do - x <- readVar var - case x of - Right res -> pure res - Left bar -> do - readMVar bar - x <- readVar var - case x of - Right res -> pure res - Left bar -> error "Control.Concurrent.Extra, internal invariant violated in Barrier" +waitBarrier (Barrier var) = readMVar var -- | A version of 'waitBarrier' that never blocks, returning 'Nothing' -- if the barrier has not yet been signaled. waitBarrierMaybe :: Barrier a -> IO (Maybe a) -waitBarrierMaybe (Barrier bar) = eitherToMaybe <$> readVar bar +waitBarrierMaybe (Barrier bar) = tryReadMVar bar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/Data/List/Extra.hs new/extra-1.7.3/src/Data/List/Extra.hs --- old/extra-1.7.1/src/Data/List/Extra.hs 2020-03-05 10:10:35.000000000 +0100 +++ new/extra-1.7.3/src/Data/List/Extra.hs 2020-05-31 00:28:19.000000000 +0200 @@ -28,10 +28,10 @@ nubOn, groupOn, nubSort, nubSortBy, nubSortOn, maximumOn, minimumOn, - disjoint, allSame, anySame, + disjoint, disjointOrd, disjointOrdBy, allSame, anySame, repeatedly, firstJust, concatUnzip, concatUnzip3, - zipFrom, zipWithFrom, + zipFrom, zipWithFrom, zipWithLongest, replace, merge, mergeBy, ) where @@ -66,6 +66,33 @@ disjoint :: Eq a => [a] -> [a] -> Bool disjoint xs = null . intersect xs +-- | /O((m+n) log m), m <= n/. Are two lists disjoint, with no elements in common. +-- +-- @disjointOrd@ is more strict than `disjoint`. For example, @disjointOrd@ cannot +-- terminate if both lists are inifite, while `disjoint` can. +-- +-- > disjointOrd [1,2,3] [4,5] == True +-- > disjointOrd [1,2,3] [4,1] == False +disjointOrd :: Ord a => [a] -> [a] -> Bool +disjointOrd = disjointOrdBy compare + +-- | A version of 'disjointOrd' with a custom predicate. +-- +-- > disjointOrdBy (compare `on` (`mod` 7)) [1,2,3] [4,5] == True +-- > disjointOrdBy (compare `on` (`mod` 7)) [1,2,3] [4,8] == False +disjointOrdBy :: (a -> a -> Ordering) -> [a] -> [a] -> Bool +disjointOrdBy cmp xs ys + | shorter xs ys = go xs ys + | otherwise = go ys xs + where + shorter _ [] = False + shorter [] _ = True + shorter (_:xs) (_:ys) = shorter xs ys + + go xs = not . any (\a -> memberRB cmp a tree) + where + tree = foldl' (flip (insertRB cmp)) E xs + -- | Is there any element which occurs more than once. -- -- > anySame [1,1,2] == True @@ -769,3 +796,17 @@ balance a x (T R b y (T R c z d)) = T R (T B a x b) y (T B c z d) balance a x (T R (T R b y c) z d) = T R (T B a x b) y (T B c z d) balance a x b = T B a x b + + +-- | Like 'zipWith', but keep going to the longest value. The function +-- argument will always be given at least one 'Just', and while both +-- lists have items, two 'Just' values. +-- +-- > zipWithLongest (,) "a" "xyz" == [(Just 'a', Just 'x'), (Nothing, Just 'y'), (Nothing, Just 'z')] +-- > zipWithLongest (,) "a" "x" == [(Just 'a', Just 'x')] +-- > zipWithLongest (,) "" "x" == [(Nothing, Just 'x')] +zipWithLongest :: (Maybe a -> Maybe b -> c) -> [a] -> [b] -> [c] +zipWithLongest f [] [] = [] +zipWithLongest f (x:xs) (y:ys) = f (Just x) (Just y) : zipWithLongest f xs ys +zipWithLongest f [] ys = map (f Nothing . Just) ys +zipWithLongest f xs [] = map ((`f` Nothing) . Just) xs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/Data/Typeable/Extra.hs new/extra-1.7.3/src/Data/Typeable/Extra.hs --- old/extra-1.7.1/src/Data/Typeable/Extra.hs 2019-02-25 17:04:47.000000000 +0100 +++ new/extra-1.7.3/src/Data/Typeable/Extra.hs 2020-05-25 14:16:00.000000000 +0200 @@ -3,7 +3,7 @@ -- The package also exports the existing "Data.Typeable" functions. -- -- Currently this module has no functionality beyond "Data.Typeable". -module Data.Typeable.Extra( +module Data.Typeable.Extra {-# DEPRECATED "Use Data.Typeable directly" #-} ( module Data.Typeable ) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/Extra.hs new/extra-1.7.3/src/Extra.hs --- old/extra-1.7.1/src/Extra.hs 2020-03-05 10:10:08.000000000 +0100 +++ new/extra-1.7.3/src/Extra.hs 2020-05-31 00:28:19.000000000 +0200 @@ -23,7 +23,7 @@ writeIORef', atomicWriteIORef', atomicModifyIORef_, atomicModifyIORef'_, -- * Data.List.Extra -- | Extra functions available in @"Data.List.Extra"@. - lower, upper, trim, trimStart, trimEnd, word1, line1, escapeHTML, escapeJSON, unescapeHTML, unescapeJSON, dropEnd, takeEnd, splitAtEnd, breakEnd, spanEnd, dropWhileEnd', takeWhileEnd, stripSuffix, stripInfix, stripInfixEnd, dropPrefix, dropSuffix, wordsBy, linesBy, breakOn, breakOnEnd, splitOn, split, chunksOf, headDef, lastDef, notNull, list, unsnoc, cons, snoc, drop1, dropEnd1, mconcatMap, enumerate, groupSort, groupSortOn, groupSortBy, nubOrd, nubOrdBy, nubOrdOn, nubOn, groupOn, nubSort, nubSortBy, nubSortOn, maximumOn, minimumOn, disjoint, allSame, anySame, repeatedly, firstJust, concatUnzip, concatUnzip3, zipFrom, zipWithFrom, replace, merge, mergeBy, + lower, upper, trim, trimStart, trimEnd, word1, line1, escapeHTML, escapeJSON, unescapeHTML, unescapeJSON, dropEnd, takeEnd, splitAtEnd, breakEnd, spanEnd, dropWhileEnd', takeWhileEnd, stripSuffix, stripInfix, stripInfixEnd, dropPrefix, dropSuffix, wordsBy, linesBy, breakOn, breakOnEnd, splitOn, split, chunksOf, headDef, lastDef, notNull, list, unsnoc, cons, snoc, drop1, dropEnd1, mconcatMap, enumerate, groupSort, groupSortOn, groupSortBy, nubOrd, nubOrdBy, nubOrdOn, nubOn, groupOn, nubSort, nubSortBy, nubSortOn, maximumOn, minimumOn, disjoint, disjointOrd, disjointOrdBy, allSame, anySame, repeatedly, firstJust, concatUnzip, concatUnzip3, zipFrom, zipWithFrom, zipWithLongest, replace, merge, mergeBy, -- * Data.List.NonEmpty.Extra -- | Extra functions available in @"Data.List.NonEmpty.Extra"@. (|:), (|>), appendl, appendr, maximum1, minimum1, maximumBy1, minimumBy1, maximumOn1, minimumOn1, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/System/Environment/Extra.hs new/extra-1.7.3/src/System/Environment/Extra.hs --- old/extra-1.7.1/src/System/Environment/Extra.hs 2019-02-25 17:06:01.000000000 +0100 +++ new/extra-1.7.3/src/System/Environment/Extra.hs 2020-05-25 14:16:19.000000000 +0200 @@ -1,9 +1,8 @@ --- | Extra functions for "System.Environment". All these functions are available in later GHC versions, --- but this code works all the way back to GHC 7.2. +-- | Extra functions for "System.Environment". -- -- Currently this module has no functionality beyond "System.Environment". -module System.Environment.Extra( +module System.Environment.Extra {-# DEPRECATED "Use System.Environment directly" #-} ( module System.Environment, ) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/System/Time/Extra.hs new/extra-1.7.3/src/System/Time/Extra.hs --- old/extra-1.7.1/src/System/Time/Extra.hs 2020-02-28 10:28:02.000000000 +0100 +++ new/extra-1.7.3/src/System/Time/Extra.hs 2020-05-25 14:59:57.000000000 +0200 @@ -15,6 +15,7 @@ import Control.Concurrent import System.Clock import Numeric.Extra +import Control.Monad.IO.Class import Control.Monad.Extra import Control.Exception.Extra import Data.Typeable @@ -108,9 +109,9 @@ -- | Record how long a computation takes in 'Seconds'. -- -- > do (a,_) <- duration $ sleep 1; pure $ a >= 1 && a <= 1.5 -duration :: IO a -> IO (Seconds, a) +duration :: MonadIO m => m a -> m (Seconds, a) duration act = do - time <- offsetTime + time <- liftIO offsetTime res <- act - time <- time + time <- liftIO time pure (time, res) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/src/Text/Read/Extra.hs new/extra-1.7.3/src/Text/Read/Extra.hs --- old/extra-1.7.1/src/Text/Read/Extra.hs 2019-02-25 17:08:09.000000000 +0100 +++ new/extra-1.7.3/src/Text/Read/Extra.hs 2020-05-17 13:24:31.000000000 +0200 @@ -2,7 +2,7 @@ -- | This module provides "Text.Read" with functions added in later versions. -- -- Currently this module has no functionality beyond "Text.Read". -module Text.Read.Extra( +module Text.Read.Extra {-# DEPRECATED "Use Text.Read directly" #-} ( module Text.Read, ) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/test/TestCustom.hs new/extra-1.7.3/test/TestCustom.hs --- old/extra-1.7.1/test/TestCustom.hs 2020-02-28 10:28:02.000000000 +0100 +++ new/extra-1.7.3/test/TestCustom.hs 2020-05-25 14:28:20.000000000 +0200 @@ -6,13 +6,13 @@ import System.IO.Extra import Data.IORef import TestUtil -import Data.Typeable.Extra as X +import Data.List.Extra as X testCustom :: IO () testCustom = do -- check that Extra really does export these things - testGen "Extra export" $ Proxy == (X.Proxy :: Proxy ()) + testGen "Extra export" $ X.sort [1] == [1] testRaw "withTempFile" $ do xs <- replicateM 4 $ onceFork $ do @@ -32,3 +32,12 @@ ref <- newIORef 2 retry 5 $ do modifyIORef ref pred; whenM ((/=) 0 <$> readIORef ref) $ fail "die" (==== 0) <$> readIORef ref + + testRaw "barrier" $ do + bar <- newBarrier + (==== Nothing) <$> waitBarrierMaybe bar + signalBarrier bar 1 + (==== Just 1) <$> waitBarrierMaybe bar + (==== 1) <$> waitBarrier bar + Left _ <- try_ $ signalBarrier bar 2 + pure () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/test/TestGen.hs new/extra-1.7.3/test/TestGen.hs --- old/extra-1.7.1/test/TestGen.hs 2020-03-05 09:43:16.000000000 +0100 +++ new/extra-1.7.3/test/TestGen.hs 2020-05-31 00:28:19.000000000 +0200 @@ -81,6 +81,10 @@ testGen "\\xs -> repeatedly line1 xs == lines xs" $ \xs -> repeatedly line1 xs == lines xs testGen "disjoint [1,2,3] [4,5] == True" $ disjoint [1,2,3] [4,5] == True testGen "disjoint [1,2,3] [4,1] == False" $ disjoint [1,2,3] [4,1] == False + testGen "disjointOrd [1,2,3] [4,5] == True" $ disjointOrd [1,2,3] [4,5] == True + testGen "disjointOrd [1,2,3] [4,1] == False" $ disjointOrd [1,2,3] [4,1] == False + testGen "disjointOrdBy (compare `on` (`mod` 7)) [1,2,3] [4,5] == True" $ disjointOrdBy (compare `on` (`mod` 7)) [1,2,3] [4,5] == True + testGen "disjointOrdBy (compare `on` (`mod` 7)) [1,2,3] [4,8] == False" $ disjointOrdBy (compare `on` (`mod` 7)) [1,2,3] [4,8] == False testGen "anySame [1,1,2] == True" $ anySame [1,1,2] == True testGen "anySame [1,2,3] == False" $ anySame [1,2,3] == False testGen "anySame (1:2:1:undefined) == True" $ anySame (1:2:1:undefined) == True @@ -241,6 +245,9 @@ testGen "\\xs -> nubOrd xs == nub xs" $ \xs -> nubOrd xs == nub xs testGen "nubOrdOn length [\"a\",\"test\",\"of\",\"this\"] == [\"a\",\"test\",\"of\"]" $ nubOrdOn length ["a","test","of","this"] == ["a","test","of"] testGen "nubOrdBy (compare `on` length) [\"a\",\"test\",\"of\",\"this\"] == [\"a\",\"test\",\"of\"]" $ nubOrdBy (compare `on` length) ["a","test","of","this"] == ["a","test","of"] + testGen "zipWithLongest (,) \"a\" \"xyz\" == [(Just 'a', Just 'x'), (Nothing, Just 'y'), (Nothing, Just 'z')]" $ zipWithLongest (,) "a" "xyz" == [(Just 'a', Just 'x'), (Nothing, Just 'y'), (Nothing, Just 'z')] + testGen "zipWithLongest (,) \"a\" \"x\" == [(Just 'a', Just 'x')]" $ zipWithLongest (,) "a" "x" == [(Just 'a', Just 'x')] + testGen "zipWithLongest (,) \"\" \"x\" == [(Nothing, Just 'x')]" $ zipWithLongest (,) "" "x" == [(Nothing, Just 'x')] testGen "(1 :| [2,3]) |> 4 |> 5 == 1 :| [2,3,4,5]" $ (1 :| [2,3]) |> 4 |> 5 == 1 :| [2,3,4,5] testGen "[1,2,3] |: 4 |> 5 == 1 :| [2,3,4,5]" $ [1,2,3] |: 4 |> 5 == 1 :| [2,3,4,5] testGen "appendl (1 :| [2,3]) [4,5] == 1 :| [2,3,4,5]" $ appendl (1 :| [2,3]) [4,5] == 1 :| [2,3,4,5] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.7.1/test/TestUtil.hs new/extra-1.7.3/test/TestUtil.hs --- old/extra-1.7.1/test/TestUtil.hs 2020-02-28 10:28:02.000000000 +0100 +++ new/extra-1.7.3/test/TestUtil.hs 2020-05-25 14:16:58.000000000 +0200 @@ -27,7 +27,6 @@ import Data.Maybe as X import Data.Monoid as X import Data.Tuple.Extra as X -import Data.Typeable.Extra as X import Data.Version.Extra as X import Numeric.Extra as X import System.Directory.Extra as X
