Hello community,
here is the log from the commit of package ghc-integer-logarithms for
openSUSE:Factory checked in at 2017-08-31 20:47:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-integer-logarithms (Old)
and /work/SRC/openSUSE:Factory/.ghc-integer-logarithms.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-integer-logarithms"
Thu Aug 31 20:47:55 2017 rev:3 rq:513402 version:1.0.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-integer-logarithms/ghc-integer-logarithms.changes
2017-04-20 20:55:51.130372225 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-integer-logarithms.new/ghc-integer-logarithms.changes
2017-08-31 20:47:56.379237422 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:07:31 UTC 2017 - [email protected]
+
+- Update to version 1.0.2.
+
+-------------------------------------------------------------------
Old:
----
integer-logarithms-1.0.1.tar.gz
integer-logarithms.cabal
New:
----
integer-logarithms-1.0.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-integer-logarithms.spec ++++++
--- /var/tmp/diff_new_pack.rCVbTA/_old 2017-08-31 20:47:57.571070129 +0200
+++ /var/tmp/diff_new_pack.rCVbTA/_new 2017-08-31 20:47:57.595066762 +0200
@@ -19,14 +19,13 @@
%global pkg_name integer-logarithms
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 1.0.1
+Version: 1.0.2
Release: 0
Summary: Integer logarithms
License: MIT
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
-Source1:
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-array-devel
BuildRequires: ghc-rpm-macros
@@ -62,7 +61,6 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
++++++ integer-logarithms-1.0.1.tar.gz -> integer-logarithms-1.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/integer-logarithms-1.0.1/changelog.md
new/integer-logarithms-1.0.2/changelog.md
--- old/integer-logarithms-1.0.1/changelog.md 2017-01-26 13:27:02.000000000
+0100
+++ new/integer-logarithms-1.0.2/changelog.md 2017-07-07 14:03:58.000000000
+0200
@@ -1,3 +1,9 @@
+1.0.2
+-----
+
+- Deprecate `Math.NumberTheory.Power.Integer` and
`Math.NumberTheory.Power.Natural` modules
+ `(^)` is as good as custom methods.
+
1.0.1
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/integer-logarithms-1.0.1/integer-logarithms.cabal
new/integer-logarithms-1.0.2/integer-logarithms.cabal
--- old/integer-logarithms-1.0.1/integer-logarithms.cabal 2017-01-26
13:27:02.000000000 +0100
+++ new/integer-logarithms-1.0.2/integer-logarithms.cabal 2017-07-07
14:03:58.000000000 +0200
@@ -1,5 +1,5 @@
name: integer-logarithms
-version: 1.0.1
+version: 1.0.2
cabal-version: >= 1.10
author: Daniel Fischer
copyright: (c) 2011 Daniel Fischer
@@ -29,7 +29,8 @@
GHC==7.6.3,
GHC==7.8.4,
GHC==7.10.3,
- GHC==8.0.1
+ GHC==8.0.2,
+ GHC==8.2.1
extra-source-files : readme.md changelog.md
@@ -47,7 +48,7 @@
default-language: Haskell2010
hs-source-dirs: src
build-depends:
- base >= 4.3 && < 4.10,
+ base >= 4.3 && < 4.11,
array >= 0.3 && < 0.6,
ghc-prim < 0.6
if impl(ghc >= 7.10)
@@ -97,16 +98,14 @@
integer-logarithms,
tasty >= 0.10 && < 0.12,
tasty-smallcheck >= 0.8 && < 0.9,
- tasty-quickcheck >= 0.8 && < 0.9,
+ tasty-quickcheck >= 0.8 && < 0.10,
tasty-hunit >= 0.9 && < 0.10,
- QuickCheck >= 2.9 && < 2.10,
+ QuickCheck >= 2.10 && < 2.11,
smallcheck >= 1.1 && < 1.2
if !impl(ghc >= 7.10)
build-depends: nats >= 1.1 && <1.2
other-modules:
Math.NumberTheory.LogarithmsTests
- Math.NumberTheory.Powers.IntegerTests
- Math.NumberTheory.Powers.NaturalTests
- other-modules:
Math.NumberTheory.TestUtils
+ Orphans
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/integer-logarithms-1.0.1/src/Math/NumberTheory/Logarithms.hs
new/integer-logarithms-1.0.2/src/Math/NumberTheory/Logarithms.hs
--- old/integer-logarithms-1.0.1/src/Math/NumberTheory/Logarithms.hs
2017-01-26 13:27:02.000000000 +0100
+++ new/integer-logarithms-1.0.2/src/Math/NumberTheory/Logarithms.hs
2017-07-07 14:03:58.000000000 +0200
@@ -53,9 +53,6 @@
import Data.Array.Base (unsafeAt)
#endif
-import Math.NumberTheory.Powers.Integer
-import Math.NumberTheory.Powers.Natural
-
-- | Calculate the integer logarithm for an arbitrary base.
-- The base must be greater than 1, the second argument, the number
-- whose logarithm is sought, must be positive, otherwise an error is thrown.
@@ -163,7 +160,7 @@
integerLog10' n
| n < 10 = 0
| n < 100 = 1
- | otherwise = ex + integerLog10' (n `quot` integerPower 10 ex)
+ | otherwise = ex + integerLog10' (n `quot` 10 ^ ex)
where
ln = I# (integerLog2# n)
-- u/v is a good approximation of log 2/log 10
@@ -179,7 +176,7 @@
naturalLog10' n
| n < 10 = 0
| n < 100 = 1
- | otherwise = ex + naturalLog10' (n `quot` naturalPower 10 ex)
+ | otherwise = ex + naturalLog10' (n `quot` 10 ^ ex)
where
ln = I# (naturalLog2# n)
-- u/v is a good approximation of log 2/log 10
@@ -204,7 +201,7 @@
ex = fromInteger ((fromIntegral u * fromIntegral ln)
`quot` fromIntegral v)
in case u of
1 -> ln `quot` v -- a power of 2, easy
- _ -> ex + integerLogBase' b (n `quot` integerPower b ex)
+ _ -> ex + integerLogBase' b (n `quot` b ^ ex)
| otherwise = let -- shift b so that 16 <= bi < 32
bi = fromInteger (b `shiftR` (lb-4))
-- we choose an approximation of log 2 / log (bi+1) to
@@ -219,7 +216,7 @@
v = fromIntegral $ logArr `unsafeAt` (ix+1)
w = v + u*fromIntegral (lb-4)
ex = fromInteger ((u * fromIntegral ln) `quot` w)
- in ex + integerLogBase' b (n `quot` integerPower b ex)
+ in ex + integerLogBase' b (n `quot` b ^ ex)
where
lb = integerLog2' b
ln = integerLog2' n
@@ -240,7 +237,7 @@
ex = fromNatural ((fromIntegral u * fromIntegral ln)
`quot` fromIntegral v)
in case u of
1 -> ln `quot` v -- a power of 2, easy
- _ -> ex + naturalLogBase' b (n `quot` naturalPower b ex)
+ _ -> ex + naturalLogBase' b (n `quot` b ^ ex)
| otherwise = let -- shift b so that 16 <= bi < 32
bi = fromNatural (b `shiftR` (lb-4))
-- we choose an approximation of log 2 / log (bi+1) to
@@ -255,7 +252,7 @@
v = fromIntegral $ logArr `unsafeAt` (ix+1)
w = v + u*fromIntegral (lb-4)
ex = fromNatural ((u * fromIntegral ln) `quot` w)
- in ex + naturalLogBase' b (n `quot` naturalPower b ex)
+ in ex + naturalLogBase' b (n `quot` b ^ ex)
where
lb = naturalLog2' b
ln = naturalLog2' n
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/integer-logarithms-1.0.1/src/Math/NumberTheory/Powers/Integer.hs
new/integer-logarithms-1.0.2/src/Math/NumberTheory/Powers/Integer.hs
--- old/integer-logarithms-1.0.1/src/Math/NumberTheory/Powers/Integer.hs
2017-01-26 13:27:02.000000000 +0100
+++ new/integer-logarithms-1.0.2/src/Math/NumberTheory/Powers/Integer.hs
2017-07-07 14:03:58.000000000 +0200
@@ -10,15 +10,15 @@
-- or 'Word' exponent.
--
{-# LANGUAGE CPP #-}
-{-# LANGUAGE MagicHash #-}
-{-# LANGUAGE BangPatterns #-}
module Math.NumberTheory.Powers.Integer
+ {-# DEPRECATED "It is no faster than (^)" #-}
( integerPower
, integerWordPower
) where
-import GHC.Exts
-import GHC.Integer.Logarithms.Compat (wordLog2#)
+#if !MIN_VERSION_base(4,8,0)
+import Data.Word
+#endif
-- | Power of an 'Integer' by the left-to-right repeated squaring algorithm.
-- This needs two multiplications in each step while the right-to-left
@@ -34,29 +34,10 @@
-- /Warning:/ No check for the negativity of the exponent is performed,
-- a negative exponent is interpreted as a large positive exponent.
integerPower :: Integer -> Int -> Integer
-integerPower b (I# e#) = power b (int2Word# e#)
+integerPower = (^)
+{-# DEPRECATED integerPower "Use (^) instead" #-}
-- | Same as 'integerPower', but for exponents of type 'Word'.
integerWordPower :: Integer -> Word -> Integer
-integerWordPower b (W# w#) = power b w#
-
-power :: Integer -> Word# -> Integer
-power b w#
- | isTrue# (w# `eqWord#` 0##) = 1
- | isTrue# (w# `eqWord#` 1##) = b
- | otherwise = go (wordLog2# w# -# 1#) b (b*b)
- where
- go 0# l h = if isTrue# ((w# `and#` 1##) `eqWord#` 0##) then l*l else
(l*h)
- go i# l h
- | w# `hasBit#` i# = go (i# -# 1#) (l*h) (h*h)
- | otherwise = go (i# -# 1#) (l*l) (l*h)
-
--- | A raw version of testBit for 'Word#'.
-hasBit# :: Word# -> Int# -> Bool
-hasBit# w# i# = isTrue# (((w# `uncheckedShiftRL#` i#) `and#` 1##) `neWord#`
0##)
-
-#if __GLASGOW_HASKELL__ < 707
--- The times they are a-changing. The types of primops too :(
-isTrue# :: Bool -> Bool
-isTrue# = id
-#endif
+integerWordPower = (^)
+{-# DEPRECATED integerWordPower "Use (^) instead" #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/integer-logarithms-1.0.1/src/Math/NumberTheory/Powers/Natural.hs
new/integer-logarithms-1.0.2/src/Math/NumberTheory/Powers/Natural.hs
--- old/integer-logarithms-1.0.1/src/Math/NumberTheory/Powers/Natural.hs
2017-01-26 13:27:02.000000000 +0100
+++ new/integer-logarithms-1.0.2/src/Math/NumberTheory/Powers/Natural.hs
2017-07-07 14:03:58.000000000 +0200
@@ -10,16 +10,17 @@
-- or 'Word' exponent.
--
{-# LANGUAGE CPP #-}
-{-# LANGUAGE MagicHash #-}
-{-# LANGUAGE BangPatterns #-}
module Math.NumberTheory.Powers.Natural
+ {-# DEPRECATED "It is no faster than (^)" #-}
( naturalPower
, naturalWordPower
) where
-import GHC.Exts
+#if !MIN_VERSION_base(4,8,0)
+import Data.Word
+#endif
+
import Numeric.Natural
-import GHC.Integer.Logarithms.Compat (wordLog2#)
-- | Power of an 'Natural' by the left-to-right repeated squaring algorithm.
-- This needs two multiplications in each step while the right-to-left
@@ -35,29 +36,10 @@
-- /Warning:/ No check for the negativity of the exponent is performed,
-- a negative exponent is interpreted as a large positive exponent.
naturalPower :: Natural -> Int -> Natural
-naturalPower b (I# e#) = power b (int2Word# e#)
+naturalPower = (^)
+{-# DEPRECATED naturalPower "Use (^) instead" #-}
-- | Same as 'naturalPower', but for exponents of type 'Word'.
naturalWordPower :: Natural -> Word -> Natural
-naturalWordPower b (W# w#) = power b w#
-
-power :: Natural -> Word# -> Natural
-power b w#
- | isTrue# (w# `eqWord#` 0##) = 1
- | isTrue# (w# `eqWord#` 1##) = b
- | otherwise = go (wordLog2# w# -# 1#) b (b*b)
- where
- go 0# l h = if isTrue# ((w# `and#` 1##) `eqWord#` 0##) then l*l else
(l*h)
- go i# l h
- | w# `hasBit#` i# = go (i# -# 1#) (l*h) (h*h)
- | otherwise = go (i# -# 1#) (l*l) (l*h)
-
--- | A raw version of testBit for 'Word#'.
-hasBit# :: Word# -> Int# -> Bool
-hasBit# w# i# = isTrue# (((w# `uncheckedShiftRL#` i#) `and#` 1##) `neWord#`
0##)
-
-#if __GLASGOW_HASKELL__ < 707
--- The times they are a-changing. The types of primops too :(
-isTrue# :: Bool -> Bool
-isTrue# = id
-#endif
+naturalWordPower = (^)
+{-# DEPRECATED naturalWordPower "Use (^) instead" #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/integer-logarithms-1.0.1/test-suite/Math/NumberTheory/LogarithmsTests.hs
new/integer-logarithms-1.0.2/test-suite/Math/NumberTheory/LogarithmsTests.hs
---
old/integer-logarithms-1.0.1/test-suite/Math/NumberTheory/LogarithmsTests.hs
2017-01-26 13:27:02.000000000 +0100
+++
new/integer-logarithms-1.0.2/test-suite/Math/NumberTheory/LogarithmsTests.hs
2017-07-07 14:03:58.000000000 +0200
@@ -27,6 +27,9 @@
import Math.NumberTheory.Logarithms
import Math.NumberTheory.TestUtils
+-- Arbitrary Natural
+import Orphans ()
+
-- | Check that 'integerLogBase' returns the largest integer @l@ such that @b@
^ @l@ <= @n@ and @b@ ^ (@l@+1) > @n@.
integerLogBaseProperty :: Positive Integer -> Positive Integer -> Bool
integerLogBaseProperty (Positive b) (Positive n) = b == 1 || b ^ l <= n && b ^
(l + 1) > n
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/integer-logarithms-1.0.1/test-suite/Math/NumberTheory/Powers/IntegerTests.hs
new/integer-logarithms-1.0.2/test-suite/Math/NumberTheory/Powers/IntegerTests.hs
---
old/integer-logarithms-1.0.1/test-suite/Math/NumberTheory/Powers/IntegerTests.hs
2017-01-26 13:27:02.000000000 +0100
+++
new/integer-logarithms-1.0.2/test-suite/Math/NumberTheory/Powers/IntegerTests.hs
1970-01-01 01:00:00.000000000 +0100
@@ -1,41 +0,0 @@
--- |
--- Module: Math.NumberTheory.Powers.IntegerTests
--- Copyright: (c) 2016 Andrew Lelechenko
--- Licence: MIT
--- Maintainer: Andrew Lelechenko <[email protected]>
--- Stability: Provisional
---
--- Tests for Math.NumberTheory.Powers.Integer
---
-
-{-# LANGUAGE CPP #-}
-
-{-# OPTIONS_GHC -fno-warn-type-defaults #-}
-
-module Math.NumberTheory.Powers.IntegerTests
- ( testSuite
- ) where
-
-import Test.Tasty
-
-#if MIN_VERSION_base(4,8,0)
-#else
-import Data.Word
-#endif
-
-import Math.NumberTheory.Powers.Integer
-import Math.NumberTheory.TestUtils
-
--- | Check that 'integerPower' == '^'.
-integerPowerProperty :: Integer -> Power Int -> Bool
-integerPowerProperty a (Power b) = integerPower a b == a ^ b
-
--- | Check that 'integerWordPower' == '^'.
-integerWordPowerProperty :: Integer -> Power Word -> Bool
-integerWordPowerProperty a (Power b) = integerWordPower a b == a ^ b
-
-testSuite :: TestTree
-testSuite = testGroup "Integer"
- [ testSmallAndQuick "integerPower" integerPowerProperty
- , testSmallAndQuick "integerWordPower" integerWordPowerProperty
- ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/integer-logarithms-1.0.1/test-suite/Math/NumberTheory/Powers/NaturalTests.hs
new/integer-logarithms-1.0.2/test-suite/Math/NumberTheory/Powers/NaturalTests.hs
---
old/integer-logarithms-1.0.1/test-suite/Math/NumberTheory/Powers/NaturalTests.hs
2017-01-26 13:27:02.000000000 +0100
+++
new/integer-logarithms-1.0.2/test-suite/Math/NumberTheory/Powers/NaturalTests.hs
1970-01-01 01:00:00.000000000 +0100
@@ -1,42 +0,0 @@
--- |
--- Module: Math.NumberTheory.Powers.NaturalTests
--- Copyright: (c) 2016 Andrew Lelechenko
--- Licence: MIT
--- Maintainer: Andrew Lelechenko <[email protected]>
--- Stability: Provisional
---
--- Tests for Math.NumberTheory.Powers.Natural
---
-
-{-# LANGUAGE CPP #-}
-
-{-# OPTIONS_GHC -fno-warn-type-defaults #-}
-
-module Math.NumberTheory.Powers.NaturalTests
- ( testSuite
- ) where
-
-import Test.Tasty
-
-#if MIN_VERSION_base(4,8,0)
-#else
-import Data.Word
-#endif
-
-import Math.NumberTheory.Powers.Natural
-import Numeric.Natural
-import Math.NumberTheory.TestUtils
-
--- | Check that 'naturalPower' == '^'.
-naturalPowerProperty :: Natural -> Power Int -> Bool
-naturalPowerProperty a (Power b) = naturalPower a b == a ^ b
-
--- | Check that 'naturalWordPower' == '^'.
-naturalWordPowerProperty :: Natural -> Power Word -> Bool
-naturalWordPowerProperty a (Power b) = naturalWordPower a b == a ^ b
-
-testSuite :: TestTree
-testSuite = testGroup "Natural"
- [ testSmallAndQuick "naturalPower" naturalPowerProperty
- , testSmallAndQuick "naturalWordPower" naturalWordPowerProperty
- ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/integer-logarithms-1.0.1/test-suite/Orphans.hs
new/integer-logarithms-1.0.2/test-suite/Orphans.hs
--- old/integer-logarithms-1.0.1/test-suite/Orphans.hs 1970-01-01
01:00:00.000000000 +0100
+++ new/integer-logarithms-1.0.2/test-suite/Orphans.hs 2017-07-07
14:03:58.000000000 +0200
@@ -0,0 +1,12 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+module Orphans () where
+
+import Numeric.Natural (Natural)
+import Test.QuickCheck (Arbitrary (..))
+
+-- | The QuickCheck-2.10 doesn't define the Arbitrary Natural instance
+-- We define own instance (and not use quickcheck-instance) to break
+-- the cycle in tests.
+instance Arbitrary Natural where
+ arbitrary = fmap (fromInteger . abs) arbitrary
+ shrink = map (fromInteger . abs) . shrink . fromIntegral
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/integer-logarithms-1.0.1/test-suite/Test.hs
new/integer-logarithms-1.0.2/test-suite/Test.hs
--- old/integer-logarithms-1.0.1/test-suite/Test.hs 2017-01-26
13:27:02.000000000 +0100
+++ new/integer-logarithms-1.0.2/test-suite/Test.hs 2017-07-07
14:03:58.000000000 +0200
@@ -1,8 +1,6 @@
import Test.Tasty
import qualified Math.NumberTheory.LogarithmsTests as Logarithms
-import qualified Math.NumberTheory.Powers.IntegerTests as PowerInteger
-import qualified Math.NumberTheory.Powers.NaturalTests as PowerNatural
main :: IO ()
main = defaultMain tests
@@ -10,6 +8,4 @@
tests :: TestTree
tests = testGroup "All"
[ Logarithms.testSuite
- , PowerInteger.testSuite
- , PowerNatural.testSuite
]