Hello community, here is the log from the commit of package ghc-extra for openSUSE:Factory checked in at 2017-03-14 10:04:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-extra (Old) and /work/SRC/openSUSE:Factory/.ghc-extra.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-extra" Tue Mar 14 10:04:36 2017 rev:12 rq:461629 version:1.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-extra/ghc-extra.changes 2016-07-21 08:05:58.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-extra.new/ghc-extra.changes 2017-03-14 10:04:37.540700901 +0100 @@ -1,0 +2,5 @@ +Sun Feb 12 14:20:44 UTC 2017 - psimons@suse.com + +- Update to version 1.5.1 with cabal2obs. + +------------------------------------------------------------------- Old: ---- extra-1.4.10.tar.gz New: ---- extra-1.5.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-extra.spec ++++++ --- /var/tmp/diff_new_pack.78ANRA/_old 2017-03-14 10:04:38.008634642 +0100 +++ /var/tmp/diff_new_pack.78ANRA/_new 2017-03-14 10:04:38.012634076 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-extra # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,15 +19,15 @@ %global pkg_name extra %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.4.10 +Version: 1.5.1 Release: 0 Summary: Extra functions I use 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 BuildRequires: ghc-Cabal-devel -# Begin cabal-rpm deps: +BuildRequires: ghc-clock-devel BuildRequires: ghc-directory-devel BuildRequires: ghc-filepath-devel BuildRequires: ghc-process-devel @@ -38,7 +38,6 @@ %if %{with tests} BuildRequires: ghc-QuickCheck-devel %endif -# End cabal-rpm deps %description A library of extra functions for the standard Haskell libraries. Most functions @@ -65,20 +64,14 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %check -%if %{with tests} -%{cabal} test -%endif - +%cabal_test %post devel %ghc_pkg_recache @@ -92,6 +85,6 @@ %files devel -f %{name}-devel.files %defattr(-,root,root,-) -%doc README.md +%doc CHANGES.txt README.md %changelog ++++++ extra-1.4.10.tar.gz -> extra-1.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/CHANGES.txt new/extra-1.5.1/CHANGES.txt --- old/extra-1.4.10/CHANGES.txt 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/CHANGES.txt 2016-10-25 23:11:40.000000000 +0200 @@ -1,5 +1,18 @@ Changelog for Extra +1.5.1 + #25, add zipFrom and zipWithFrom + #24, add eitherToMaybe and maybeToEither + Add fromLeft' and fromRight' +1.5 + Change fromLeft/fromRight signatures to follow the base libraries +1.4.12 + Add writeVar +1.4.11 + Require QuickCheck 2.9 + #23, deprecate offsetTimeIncrease and subtract + #22, improve offsetTime to give reliable measurements + Depend on the clock library 1.4.10 Add Data.Typeable.Extra containing typeRep, Proxy, (:~:) 1.4.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/README.md new/extra-1.5.1/README.md --- old/extra-1.4.10/README.md 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/README.md 2016-10-25 23:11:40.000000000 +0200 @@ -30,3 +30,5 @@ * base 4.6 == GHC 7.6 * base 4.5 == GHC 7.4 * base 4.4 == GHC 7.2 + +A more complete list can be found [here](https://wiki.haskell.org/Base_package#Versions). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/extra.cabal new/extra-1.5.1/extra.cabal --- old/extra-1.4.10/extra.cabal 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/extra.cabal 2016-10-25 23:11:40.000000000 +0200 @@ -1,7 +1,7 @@ -cabal-version: >= 1.10 +cabal-version: >= 1.18 build-type: Simple name: extra -version: 1.4.10 +version: 1.5.1 license: BSD3 license-file: LICENSE category: Development @@ -35,6 +35,7 @@ directory, filepath, process, + clock >= 0.7, time if !os(windows) build-depends: unix @@ -66,8 +67,9 @@ directory, filepath, extra, + clock >= 0.7, time, - QuickCheck + QuickCheck >= 2.9 if !os(windows) build-depends: unix hs-source-dirs: test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/src/Control/Concurrent/Extra.hs new/extra-1.5.1/src/Control/Concurrent/Extra.hs --- old/extra-1.4.10/src/Control/Concurrent/Extra.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/src/Control/Concurrent/Extra.hs 2016-10-25 23:11:40.000000000 +0200 @@ -19,7 +19,7 @@ -- * Lock Lock, newLock, withLock, withLockTry, -- * Var - Var, newVar, readVar, modifyVar, modifyVar_, withVar, + Var, newVar, readVar, writeVar, modifyVar, modifyVar_, withVar, -- * Barrier Barrier, newBarrier, signalBarrier, waitBarrier, waitBarrierMaybe, ) where @@ -179,6 +179,10 @@ readVar :: Var a -> IO a readVar (Var x) = readMVar x +-- | Write a value to become the new value of 'Var'. +writeVar :: Var a -> a -> IO () +writeVar v x = modifyVar_ v $ const $ return x + -- | Modify a 'Var' producing a new value and a return result. modifyVar :: Var a -> (a -> IO (a, b)) -> IO b modifyVar (Var x) f = modifyMVar x f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/src/Data/Either/Extra.hs new/extra-1.5.1/src/Data/Either/Extra.hs --- old/extra-1.4.10/src/Data/Either/Extra.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/src/Data/Either/Extra.hs 2016-10-25 23:11:40.000000000 +0200 @@ -6,28 +6,55 @@ -- partial, and should be used with care in production-quality code. module Data.Either.Extra( module Data.Either, - isLeft, isRight, fromLeft, fromRight, fromEither + isLeft, isRight, fromLeft, fromRight, fromEither, + fromLeft', fromRight', + eitherToMaybe, maybeToEither, ) where import Data.Either --- | The 'fromLeft' function extracts the element out of a 'Left' and + +#if __GLASGOW_HASKELL__ < 801 + +-- | Return the contents of a 'Left'-value or a default value otherwise. +-- +-- > fromLeft 1 (Left 3) == 3 +-- > fromLeft 1 (Right "foo") == 1 +fromLeft :: a -> Either a b -> a +fromLeft _ (Left a) = a +fromLeft a _ = a + +-- | Return the contents of a 'Right'-value or a default value otherwise. +-- +-- > fromRight 1 (Right 3) == 3 +-- > fromRight 1 (Left "foo") == 1 +fromRight :: b -> Either a b -> b +fromRight _ (Right b) = b +fromRight b _ = b + +#endif + + +-- | The 'fromLeft'' function extracts the element out of a 'Left' and -- throws an error if its argument is 'Right'. -- Much like 'fromJust', using this function in polished code is usually a bad idea. -- --- > \x -> fromLeft (Left x) == x --- > \x -> fromLeft (Right x) == undefined -fromLeft :: Either l r -> l -fromLeft (Left x) = x +-- > \x -> fromLeft' (Left x) == x +-- > \x -> fromLeft' (Right x) == undefined +fromLeft' :: Either l r -> l +fromLeft' (Left x) = x +fromLeft' _ = error "fromLeft', given a Right" --- | The 'fromRight' function extracts the element out of a 'Right' and +-- | The 'fromRight'' function extracts the element out of a 'Right' and -- throws an error if its argument is 'Left'. -- Much like 'fromJust', using this function in polished code is usually a bad idea. -- --- > \x -> fromRight (Right x) == x --- > \x -> fromRight (Left x) == undefined -fromRight :: Either l r -> r -fromRight (Right x) = x +-- > \x -> fromRight' (Right x) == x +-- > \x -> fromRight' (Left x) == undefined +fromRight' :: Either l r -> r +fromRight' (Right x) = x +fromRight' _ = error "fromRight', given a Left" + #if __GLASGOW_HASKELL__ < 708 -- | Test if an 'Either' value is the 'Left' constructor. @@ -48,3 +75,20 @@ -- > \x -> fromEither (Right x) == x fromEither :: Either a a -> a fromEither = either id id + + +-- | Given a 'Maybe', convert it to an 'Either', providing a suitable +-- value for the 'Left' should the value be 'Nothing'. +-- +-- > \a b -> maybeToEither a (Just b) == Right b +-- > \a -> maybeToEither a Nothing == Left a +maybeToEither :: a -> Maybe b -> Either a b +maybeToEither a (Just b) = Right b +maybeToEither a Nothing = Left a + +-- | Given an 'Either', convert it to a 'Maybe', where 'Left' becomes 'Nothing'. +-- +-- > \x -> eitherToMaybe (Left x) == Nothing +-- > \x -> eitherToMaybe (Right x) == Just x +eitherToMaybe :: Either a b -> Maybe b +eitherToMaybe = either (const Nothing) Just diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/src/Data/List/Extra.hs new/extra-1.5.1/src/Data/List/Extra.hs --- old/extra-1.4.10/src/Data/List/Extra.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/src/Data/List/Extra.hs 2016-10-25 23:11:40.000000000 +0200 @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, TupleSections #-} +{-# LANGUAGE CPP, TupleSections, BangPatterns #-} {-# OPTIONS_GHC -fno-warn-duplicate-exports #-} -- | This module extends "Data.List" with extra functions of a similar nature. @@ -24,6 +24,7 @@ disjoint, allSame, anySame, repeatedly, for, firstJust, concatUnzip, concatUnzip3, + zipFrom, zipWithFrom, replace, merge, mergeBy, ) where @@ -173,6 +174,25 @@ f xs _ = ([], xs) +-- | 'zip' against an enumeration. +-- Never truncates the output - raises an error if the enumeration runs out. +-- +-- > \i xs -> zip [i..] xs == zipFrom i xs +-- > zipFrom False [1..3] == undefined +zipFrom :: Enum a => a -> [b] -> [(a, b)] +zipFrom = zipWithFrom (,) + +-- | 'zipFrom' generalised to any combining operation. +-- +-- > \i xs -> zipWithFrom (,) i xs == zipFrom i xs +zipWithFrom :: Enum a => (a -> b -> c) -> a -> [b] -> [c] +zipWithFrom f a xs = go a xs + where + -- if we aren't strict in the accumulator, it's highly like to be a space leak + go !a [] = [] + go !a (x:xs) = f a x : go (succ a) xs + + -- | A merging of 'unzip' and 'concat'. -- -- > concatUnzip [("a","AB"),("bc","C")] == ("abc","ABC") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/src/Extra.hs new/extra-1.5.1/src/Extra.hs --- old/extra-1.4.10/src/Extra.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/src/Extra.hs 2016-10-25 23:11:40.000000000 +0200 @@ -8,7 +8,7 @@ module Extra( -- * Control.Concurrent.Extra -- | Extra functions available in @"Control.Concurrent.Extra"@. - getNumCapabilities, setNumCapabilities, withNumCapabilities, forkFinally, once, onceFork, Lock, newLock, withLock, withLockTry, Var, newVar, readVar, modifyVar, modifyVar_, withVar, Barrier, newBarrier, signalBarrier, waitBarrier, waitBarrierMaybe, + getNumCapabilities, setNumCapabilities, withNumCapabilities, forkFinally, once, onceFork, Lock, newLock, withLock, withLockTry, Var, newVar, readVar, writeVar, modifyVar, modifyVar_, withVar, Barrier, newBarrier, signalBarrier, waitBarrier, waitBarrierMaybe, -- * Control.Exception.Extra -- | Extra functions available in @"Control.Exception.Extra"@. retry, retryBool, showException, stringException, errorIO, displayException, ignore, catch_, handle_, try_, catchJust_, handleJust_, tryJust_, catchBool, handleBool, tryBool, @@ -17,13 +17,13 @@ whenJust, whenJustM, unit, maybeM, eitherM, loopM, whileM, partitionM, concatMapM, concatForM, mconcatMapM, mapMaybeM, findM, firstJustM, whenM, unlessM, ifM, notM, (||^), (&&^), orM, andM, anyM, allM, -- * Data.Either.Extra -- | Extra functions available in @"Data.Either.Extra"@. - isLeft, isRight, fromLeft, fromRight, fromEither, + isLeft, isRight, fromLeft, fromRight, fromEither, fromLeft', fromRight', eitherToMaybe, maybeToEither, -- * Data.IORef.Extra -- | Extra functions available in @"Data.IORef.Extra"@. modifyIORef', writeIORef', atomicModifyIORef', atomicWriteIORef, atomicWriteIORef', -- * Data.List.Extra -- | Extra functions available in @"Data.List.Extra"@. - lower, upper, trim, trimStart, trimEnd, word1, line1, dropEnd, takeEnd, splitAtEnd, breakEnd, spanEnd, dropWhileEnd, dropWhileEnd', takeWhileEnd, stripSuffix, stripInfix, stripInfixEnd, wordsBy, linesBy, breakOn, breakOnEnd, splitOn, split, chunksOf, list, uncons, unsnoc, cons, snoc, drop1, mconcatMap, groupSort, groupSortOn, groupSortBy, nubOrd, nubOrdBy, nubOrdOn, nubOn, groupOn, sortOn, disjoint, allSame, anySame, repeatedly, for, firstJust, concatUnzip, concatUnzip3, replace, merge, mergeBy, + lower, upper, trim, trimStart, trimEnd, word1, line1, dropEnd, takeEnd, splitAtEnd, breakEnd, spanEnd, dropWhileEnd, dropWhileEnd', takeWhileEnd, stripSuffix, stripInfix, stripInfixEnd, wordsBy, linesBy, breakOn, breakOnEnd, splitOn, split, chunksOf, list, uncons, unsnoc, cons, snoc, drop1, mconcatMap, groupSort, groupSortOn, groupSortBy, nubOrd, nubOrdBy, nubOrdOn, nubOn, groupOn, sortOn, disjoint, allSame, anySame, repeatedly, for, firstJust, concatUnzip, concatUnzip3, zipFrom, zipWithFrom, replace, merge, mergeBy, -- * Data.Tuple.Extra -- | Extra functions available in @"Data.Tuple.Extra"@. first, second, (***), (&&&), dupe, both, fst3, snd3, thd3, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/src/System/Time/Extra.hs new/extra-1.5.1/src/System/Time/Extra.hs --- old/extra-1.4.10/src/System/Time/Extra.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/src/System/Time/Extra.hs 2016-10-25 23:11:40.000000000 +0200 @@ -15,8 +15,8 @@ import Control.Concurrent import Data.Time.Clock +import System.Clock import Numeric.Extra -import Data.IORef import Control.Monad.Extra import Control.Exception.Extra import Data.Typeable @@ -72,11 +72,12 @@ (\_ -> fmap Just f)) +-- Once we remove subtractTime we can remove the dependency on the time package entire. +{-# DEPRECATED subtractTime "Function is being retired - use diffUTCTime directly." #-} + -- | Calculate the difference between two times in seconds. -- Usually the first time will be the end of an event, and the -- second time will be the beginning. --- --- > \a b -> a > b ==> subtractTime a b > 0 subtractTime :: UTCTime -> UTCTime -> Seconds subtractTime end start = fromRational $ toRational $ end `diffUTCTime` start @@ -98,28 +99,27 @@ where (ms,ss) = round x `divMod` 60 --- | Call once to start, then call repeatedly to get the elapsed time since the first --- call. Values will usually increase, unless the system clock is updated --- (if you need the guarantee, see 'offsetTimeIncrease'). +-- | Call once to start, then call repeatedly to get the elapsed time since the first call. +-- The time is guaranteed to be monotonic. This function is robust to system time changes. +-- +-- > do f <- offsetTime; xs <- replicateM 10 f; return $ xs == sort xs offsetTime :: IO (IO Seconds) offsetTime = do - start <- getCurrentTime + start <- time return $ do - end <- getCurrentTime - return $ end `subtractTime` start + end <- time + return $ 1e-9 * fromIntegral (toNanoSecs $ end - start) + where time = getTime Monotonic --- | Like 'offsetTime', but results will never decrease (though they may stay the same). --- --- > do f <- offsetTimeIncrease; xs <- replicateM 10 f; return $ xs == sort xs +{-# DEPRECATED offsetTimeIncrease "Use offsetTime instead, which is guaranteed to always increase." #-} + +-- | A synonym for 'offsetTime'. offsetTimeIncrease :: IO (IO Seconds) -offsetTimeIncrease = do - t <- offsetTime - ref <- newIORef 0 - return $ do - t <- t - atomicModifyIORef ref $ \o -> let m = max t o in m `seq` (m, m) +offsetTimeIncrease = offsetTime -- | Record how long a computation takes in 'Seconds'. +-- +-- > do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.1 duration :: IO a -> IO (Seconds, a) duration act = do time <- offsetTime diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/test/TestGen.hs new/extra-1.5.1/test/TestGen.hs --- old/extra-1.4.10/test/TestGen.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/test/TestGen.hs 2016-10-25 23:11:40.000000000 +0200 @@ -49,12 +49,20 @@ testGen "findM (Just . isUpper) \"teST\" == Just (Just 'S')" $ findM (Just . isUpper) "teST" == Just (Just 'S') testGen "findM (Just . isUpper) \"test\" == Just Nothing" $ findM (Just . isUpper) "test" == Just Nothing testGen "findM (Just . const True) [\"x\",undefined] == Just (Just \"x\")" $ findM (Just . const True) ["x",undefined] == Just (Just "x") - testGen "\\x -> fromLeft (Left x) == x" $ \x -> fromLeft (Left x) == x - testGen "\\x -> fromLeft (Right x) == undefined" $ \x -> erroneous $ fromLeft (Right x) - testGen "\\x -> fromRight (Right x) == x" $ \x -> fromRight (Right x) == x - testGen "\\x -> fromRight (Left x) == undefined" $ \x -> erroneous $ fromRight (Left x) + testGen "fromLeft 1 (Left 3) == 3" $ fromLeft 1 (Left 3) == 3 + testGen "fromLeft 1 (Right \"foo\") == 1" $ fromLeft 1 (Right "foo") == 1 + testGen "fromRight 1 (Right 3) == 3" $ fromRight 1 (Right 3) == 3 + testGen "fromRight 1 (Left \"foo\") == 1" $ fromRight 1 (Left "foo") == 1 + testGen "\\x -> fromLeft' (Left x) == x" $ \x -> fromLeft' (Left x) == x + testGen "\\x -> fromLeft' (Right x) == undefined" $ \x -> erroneous $ fromLeft' (Right x) + testGen "\\x -> fromRight' (Right x) == x" $ \x -> fromRight' (Right x) == x + testGen "\\x -> fromRight' (Left x) == undefined" $ \x -> erroneous $ fromRight' (Left x) testGen "\\x -> fromEither (Left x ) == x" $ \x -> fromEither (Left x ) == x testGen "\\x -> fromEither (Right x) == x" $ \x -> fromEither (Right x) == x + testGen "\\a b -> maybeToEither a (Just b) == Right b" $ \a b -> maybeToEither a (Just b) == Right b + testGen "\\a -> maybeToEither a Nothing == Left a" $ \a -> maybeToEither a Nothing == Left a + testGen "\\x -> eitherToMaybe (Left x) == Nothing" $ \x -> eitherToMaybe (Left x) == Nothing + testGen "\\x -> eitherToMaybe (Right x) == Just x" $ \x -> eitherToMaybe (Right x) == Just x testGen "\\xs -> repeatedly (splitAt 3) xs == chunksOf 3 xs" $ \xs -> repeatedly (splitAt 3) xs == chunksOf 3 xs testGen "\\xs -> repeatedly word1 (trim xs) == words xs" $ \xs -> repeatedly word1 (trim xs) == words xs testGen "\\xs -> repeatedly line1 xs == lines xs" $ \xs -> repeatedly line1 xs == lines xs @@ -100,6 +108,9 @@ testGen "splitAtEnd 3 \"he\" == (\"\", \"he\")" $ splitAtEnd 3 "he" == ("", "he") testGen "\\i xs -> uncurry (++) (splitAt i xs) == xs" $ \i xs -> uncurry (++) (splitAt i xs) == xs testGen "\\i xs -> splitAtEnd i xs == (dropEnd i xs, takeEnd i xs)" $ \i xs -> splitAtEnd i xs == (dropEnd i xs, takeEnd i xs) + testGen "\\i xs -> zip [i..] xs == zipFrom i xs" $ \i xs -> zip [i..] xs == zipFrom i xs + testGen "zipFrom False [1..3] == undefined" $ erroneous $ zipFrom False [1..3] + testGen "\\i xs -> zipWithFrom (,) i xs == zipFrom i xs" $ \i xs -> zipWithFrom (,) i xs == zipFrom i xs testGen "concatUnzip [(\"a\",\"AB\"),(\"bc\",\"C\")] == (\"abc\",\"ABC\")" $ concatUnzip [("a","AB"),("bc","C")] == ("abc","ABC") testGen "concatUnzip3 [(\"a\",\"AB\",\"\"),(\"bc\",\"C\",\"123\")] == (\"abc\",\"ABC\",\"123\")" $ concatUnzip3 [("a","AB",""),("bc","C","123")] == ("abc","ABC","123") testGen "takeWhileEnd even [2,3,4,6] == [4,6]" $ takeWhileEnd even [2,3,4,6] == [4,6] @@ -232,9 +243,9 @@ testGen "timeout 0.1 (print 1) == fmap Just (print 1)" $ timeout 0.1 (print 1) == fmap Just (print 1) testGen "do (t, _) <- duration $ timeout 0.1 $ sleep 1000; print t; return $ t < 1" $ do (t, _) <- duration $ timeout 0.1 $ sleep 1000; print t; return $ t < 1 testGen "timeout 0.1 (sleep 2 >> print 1) == return Nothing" $ timeout 0.1 (sleep 2 >> print 1) == return Nothing - testGen "\\a b -> a > b ==> subtractTime a b > 0" $ \a b -> a > b ==> subtractTime a b > 0 testGen "showDuration 3.435 == \"3.44s\"" $ showDuration 3.435 == "3.44s" testGen "showDuration 623.8 == \"10m24s\"" $ showDuration 623.8 == "10m24s" testGen "showDuration 62003.8 == \"17h13m\"" $ showDuration 62003.8 == "17h13m" testGen "showDuration 1e8 == \"27777h47m\"" $ showDuration 1e8 == "27777h47m" - testGen "do f <- offsetTimeIncrease; xs <- replicateM 10 f; return $ xs == sort xs" $ do f <- offsetTimeIncrease; xs <- replicateM 10 f; return $ xs == sort xs + testGen "do f <- offsetTime; xs <- replicateM 10 f; return $ xs == sort xs" $ do f <- offsetTime; xs <- replicateM 10 f; return $ xs == sort xs + testGen "do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.1" $ do (a,_) <- duration $ sleep 1; return $ a >= 1 && a <= 1.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/extra-1.4.10/test/TestUtil.hs new/extra-1.5.1/test/TestUtil.hs --- old/extra-1.4.10/test/TestUtil.hs 2016-06-15 20:37:00.000000000 +0200 +++ new/extra-1.5.1/test/TestUtil.hs 2016-10-25 23:11:40.000000000 +0200 @@ -47,11 +47,11 @@ modifyIORef testCount (+1) -erroneous :: a -> Bool -erroneous x = unsafePerformIO $ fmap isLeft $ try_ $ evaluate x +erroneous :: Show a => a -> Bool +erroneous x = unsafePerformIO $ fmap isLeft $ try_ $ evaluate $ length $ show x -erroneousIO :: IO a -> Bool -erroneousIO x = unsafePerformIO $ fmap isLeft $ try_ $ evaluate =<< x +erroneousIO :: Show a => IO a -> Bool +erroneousIO x = unsafePerformIO $ fmap isLeft $ try_ $ evaluate . length . show =<< x (====) :: (Show a, Eq a) => a -> a -> Bool a ==== b = if a == b then True else error $ "Not equal!\n" ++ show a ++ "\n" ++ show b @@ -70,11 +70,9 @@ instance Testable () where property = property . (`seq` True) - exhaustive _ = True instance Testable a => Testable (IO a) where property = property . unsafePerformIO - exhaustive = exhaustive . unsafePerformIO instance Eq a => Eq (IO a) where a == b = unsafePerformIO $ do @@ -104,6 +102,3 @@ instance Arbitrary DiffTime where arbitrary = fmap realToFrac $ choose (0 :: Double, 86401) - -instance Arbitrary Version where - arbitrary = makeVersion . map abs <$> listOf1 arbitrary