Hello community, here is the log from the commit of package ghc-smallcheck for openSUSE:Factory checked in at 2018-05-30 12:13:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-smallcheck (Old) and /work/SRC/openSUSE:Factory/.ghc-smallcheck.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-smallcheck" Wed May 30 12:13:44 2018 rev:3 rq:607886 version:1.1.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-smallcheck/ghc-smallcheck.changes 2017-05-27 13:15:38.898549725 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-smallcheck.new/ghc-smallcheck.changes 2018-05-30 12:27:15.586375495 +0200 @@ -1,0 +2,10 @@ +Mon May 14 17:02:11 UTC 2018 - [email protected] + +- Update smallcheck to version 1.1.4. + * Add instances for fixed-width Int and Word types (Int8, Word8 etc.) + * Fix compatibility with GHC 7.8 and older + * Add `Serial` and `CoSerial` instances for `Word` and `Natural` + * Export the `test` function + * Add a `listSeries` function + +------------------------------------------------------------------- Old: ---- smallcheck-1.1.1.tar.gz smallcheck.cabal New: ---- smallcheck-1.1.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-smallcheck.spec ++++++ --- /var/tmp/diff_new_pack.USWKnS/_old 2018-05-30 12:27:16.298350815 +0200 +++ /var/tmp/diff_new_pack.USWKnS/_new 2018-05-30 12:27:16.302350676 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-smallcheck # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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 @@ -18,20 +18,18 @@ %global pkg_name smallcheck Name: ghc-%{pkg_name} -Version: 1.1.1 +Version: 1.1.4 Release: 0 Summary: A property-based testing library License: BSD-3-Clause -Group: Development/Languages/Other -Url: https://hackage.haskell.org/package/%{pkg_name} +Group: Development/Libraries/Haskell +URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-logict-devel BuildRequires: ghc-mtl-devel BuildRequires: ghc-pretty-devel BuildRequires: ghc-rpm-macros -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description SmallCheck is a testing library that allows to verify properties for all test @@ -40,7 +38,7 @@ %package devel Summary: Haskell %{pkg_name} library development files -Group: Development/Libraries/Other +Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} @@ -51,7 +49,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build @@ -66,11 +63,9 @@ %ghc_pkg_recache %files -f %{name}.files -%defattr(-,root,root,-) -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files -%defattr(-,root,root,-) %doc CHANGELOG.md README.md %changelog ++++++ smallcheck-1.1.1.tar.gz -> smallcheck-1.1.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smallcheck-1.1.1/CHANGELOG.md new/smallcheck-1.1.4/CHANGELOG.md --- old/smallcheck-1.1.1/CHANGELOG.md 2013-12-16 18:06:49.000000000 +0100 +++ new/smallcheck-1.1.4/CHANGELOG.md 2018-05-12 16:05:11.000000000 +0200 @@ -1,6 +1,27 @@ Changes ======= +Version 1.1.4 +------------- + +* Add instances for fixed-width Int and Word types (Int8, Word8 etc.) + +Version 1.1.3.1 +--------------- + +* Fix compatibility with GHC 7.8 and older + +Version 1.1.3 +------------- + +* Add `Serial` and `CoSerial` instances for `Word` and `Natural` + +Version 1.1.2 +------------- + +* Export the `test` function +* Add a `listSeries` function + Version 1.1.1 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smallcheck-1.1.1/README.md new/smallcheck-1.1.4/README.md --- old/smallcheck-1.1.1/README.md 2013-12-16 18:06:49.000000000 +0100 +++ new/smallcheck-1.1.4/README.md 2017-08-08 18:25:03.000000000 +0200 @@ -28,3 +28,11 @@ [comparison]: https://github.com/feuerbach/smallcheck/wiki/Comparison-with-QuickCheck [github]: https://github.com/feuerbach/smallcheck [issues]: https://github.com/feuerbach/smallcheck/issues + +Maintainers +----------- + +[Roman Cheplyaka](https://github.com/feuerbach) is the primary maintainer. + +[Oliver Charles](https://github.com/ocharles) is the backup maintainer. Please +get in touch with him if the primary maintainer cannot be reached. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smallcheck-1.1.1/Test/SmallCheck/Series.hs new/smallcheck-1.1.4/Test/SmallCheck/Series.hs --- old/smallcheck-1.1.1/Test/SmallCheck/Series.hs 2013-12-16 18:06:49.000000000 +0100 +++ new/smallcheck-1.1.4/Test/SmallCheck/Series.hs 2018-05-12 15:59:45.000000000 +0200 @@ -174,6 +174,7 @@ decDepth, getDepth, generate, + listSeries, list, listM, fixDepth, @@ -186,8 +187,11 @@ import Control.Monad.Reader import Control.Applicative import Control.Monad.Identity +import Data.Int (Int, Int8, Int16, Int32, Int64) import Data.List import Data.Ratio +import Data.Word (Word, Word8, Word16, Word32, Word64) +import Numeric.Natural (Natural) import Test.SmallCheck.SeriesMonad import GHC.Generics @@ -228,8 +232,26 @@ suchThat :: Series m a -> (a -> Bool) -> Series m a suchThat s p = s >>= \x -> if p x then pure x else empty +-- | Given a depth, return the list of values generated by a Serial instance. +-- +-- Example, list all integers up to depth 1: +-- +-- * @listSeries 1 :: [Int] -- returns [0,1,-1]@ +listSeries :: Serial Identity a => Depth -> [a] +listSeries d = list d series + -- | Return the list of values generated by a 'Series'. Useful for -- debugging 'Serial' instances. +-- +-- Examples: +-- +-- * @list 3 'series' :: [Int] -- returns [0,1,-1,2,-2,3,-3]@ +-- +-- * @list 3 ('series' :: 'Series' 'Identity' Int) -- returns [0,1,-1,2,-2,3,-3]@ +-- +-- * @list 2 'series' :: [[Bool]] -- returns [[],[True],[False]]@ +-- +-- The first two are equivalent. The second has a more explicit type binding. list :: Depth -> Series Identity a -> [a] list d s = runIdentity $ observeAllT $ runSeries d s @@ -443,36 +465,38 @@ instance Monad m => CoSerial m () where coseries rs = constM rs -instance Monad m => Serial m Int where - series = - generate (\d -> if d >= 0 then pure 0 else empty) <|> - nats `interleave` (fmap negate nats) - where - nats = generate $ \d -> [1..d] - -instance Monad m => CoSerial m Int where - coseries rs = - alts0 rs >>- \z -> - alts1 rs >>- \f -> - alts1 rs >>- \g -> - return $ \i -> case () of { _ - | i > 0 -> f (N (i - 1)) - | i < 0 -> g (N (abs i - 1)) - | otherwise -> z - } - -instance Monad m => Serial m Integer where - series = (toInteger :: Int -> Integer) <$> series -instance Monad m => CoSerial m Integer where - coseries rs = (. (fromInteger :: Integer->Int)) <$> coseries rs +instance Monad m => Serial m Integer where series = unM <$> series +instance Monad m => CoSerial m Integer where coseries = fmap (. M) . coseries +instance Monad m => Serial m Natural where series = unN <$> series +instance Monad m => CoSerial m Natural where coseries = fmap (. N) . coseries +instance Monad m => Serial m Int where series = unM <$> series +instance Monad m => CoSerial m Int where coseries = fmap (. M) . coseries +instance Monad m => Serial m Word where series = unN <$> series +instance Monad m => CoSerial m Word where coseries = fmap (. N) . coseries +instance Monad m => Serial m Int8 where series = unM <$> series +instance Monad m => CoSerial m Int8 where coseries = fmap (. M) . coseries +instance Monad m => Serial m Word8 where series = unN <$> series +instance Monad m => CoSerial m Word8 where coseries = fmap (. N) . coseries +instance Monad m => Serial m Int16 where series = unM <$> series +instance Monad m => CoSerial m Int16 where coseries = fmap (. M) . coseries +instance Monad m => Serial m Word16 where series = unN <$> series +instance Monad m => CoSerial m Word16 where coseries = fmap (. N) . coseries +instance Monad m => Serial m Int32 where series = unM <$> series +instance Monad m => CoSerial m Int32 where coseries = fmap (. M) . coseries +instance Monad m => Serial m Word32 where series = unN <$> series +instance Monad m => CoSerial m Word32 where coseries = fmap (. N) . coseries +instance Monad m => Serial m Int64 where series = unM <$> series +instance Monad m => CoSerial m Int64 where coseries = fmap (. M) . coseries +instance Monad m => Serial m Word64 where series = unN <$> series +instance Monad m => CoSerial m Word64 where coseries = fmap (. N) . coseries -- | 'N' is a wrapper for 'Integral' types that causes only non-negative values -- to be generated. Generated functions of type @N a -> b@ do not distinguish -- different negative values of @a@. -newtype N a = N a deriving (Eq, Ord, Real, Enum, Num, Integral) +newtype N a = N { unN :: a } deriving (Eq, Ord, Real, Enum, Num, Integral) -instance (Integral a, Serial m a) => Serial m (N a) where - series = generate $ \d -> map (N . fromIntegral) [0..d] +instance (Num a, Enum a, Serial m a) => Serial m (N a) where + series = generate $ \d -> take (d+1) [0..] instance (Integral a, Monad m) => CoSerial m (N a) where coseries rs = @@ -488,6 +512,24 @@ then f (N $ i-1) else z +-- | 'M' is a helper type to generate values of a signed type of increasing magnitude. +newtype M a = M { unM :: a } deriving (Eq, Ord, Real, Enum, Num, Integral) + +instance (Num a, Enum a, Monad m) => Serial m (M a) where + series = others `interleave` positives + where positives = generate $ \d -> take d [1..] + others = generate $ \d -> take (d+1) [0,-1..] + +instance (Ord a, Num a, Monad m) => CoSerial m (M a) where + coseries rs = + alts0 rs >>- \z -> + alts1 rs >>- \f -> + alts1 rs >>- \g -> + pure $ \ i -> case compare i 0 of + GT -> f (M (i - 1)) + LT -> g (M (abs i - 1)) + EQ -> z + instance Monad m => Serial m Float where series = series >>- \(sig, exp) -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smallcheck-1.1.1/Test/SmallCheck.hs new/smallcheck-1.1.4/Test/SmallCheck.hs --- old/smallcheck-1.1.1/Test/SmallCheck.hs 2013-12-16 18:06:49.000000000 +0100 +++ new/smallcheck-1.1.4/Test/SmallCheck.hs 2017-08-08 18:25:03.000000000 +0200 @@ -92,7 +92,7 @@ smallCheck, -- * Main types and classes - Testable, + Testable(..), Property, Reason diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smallcheck-1.1.1/smallcheck.cabal new/smallcheck-1.1.4/smallcheck.cabal --- old/smallcheck-1.1.1/smallcheck.cabal 2013-12-16 18:06:49.000000000 +0100 +++ new/smallcheck-1.1.4/smallcheck.cabal 2018-05-12 16:04:18.000000000 +0200 @@ -1,5 +1,5 @@ Name: smallcheck -Version: 1.1.1 +Version: 1.1.4 Cabal-Version: >= 1.6 License: BSD3 License-File: LICENSE @@ -26,7 +26,10 @@ Library - Build-Depends: base == 4.*, mtl, logict, ghc-prim >= 0.2, pretty + Build-Depends: base >= 4.5 && < 5, mtl, logict, ghc-prim >= 0.2, pretty + + if impl(ghc < 7.10) + build-depends: nats Exposed-modules: Test.SmallCheck
