Hello community,
here is the log from the commit of package ghc-diagrams-solve for
openSUSE:Factory checked in at 2017-07-27 11:11:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-diagrams-solve (Old)
and /work/SRC/openSUSE:Factory/.ghc-diagrams-solve.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-diagrams-solve"
Thu Jul 27 11:11:40 2017 rev:2 rq:511509 version:0.1.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-diagrams-solve/ghc-diagrams-solve.changes
2016-11-02 12:31:17.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-diagrams-solve.new/ghc-diagrams-solve.changes
2017-07-27 11:11:43.113926496 +0200
@@ -1,0 +2,5 @@
+Tue Jul 11 03:02:31 UTC 2017 - [email protected]
+
+- Update to version 0.1.1.
+
+-------------------------------------------------------------------
Old:
----
diagrams-solve-0.1.0.1.tar.gz
New:
----
diagrams-solve-0.1.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-diagrams-solve.spec ++++++
--- /var/tmp/diff_new_pack.x1I5Rt/_old 2017-07-27 11:11:43.545865481 +0200
+++ /var/tmp/diff_new_pack.x1I5Rt/_new 2017-07-27 11:11:43.545865481 +0200
@@ -1,7 +1,7 @@
#
# spec file for package ghc-diagrams-solve
#
-# 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
@@ -17,17 +17,24 @@
%global pkg_name diagrams-solve
+%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.1.0.1
+Version: 0.1.1
Release: 0
Summary: Pure Haskell solver routines used by diagrams
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
BuildRequires: ghc-rpm-macros
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+%if %{with tests}
+BuildRequires: ghc-deepseq-devel
+BuildRequires: ghc-tasty-devel
+BuildRequires: ghc-tasty-hunit-devel
+BuildRequires: ghc-tasty-quickcheck-devel
+%endif
%description
Pure Haskell solver routines used by the diagrams project. Currently includes
@@ -48,14 +55,14 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-
%build
%ghc_lib_build
-
%install
%ghc_lib_install
+%check
+%cabal_test
%post devel
%ghc_pkg_recache
@@ -69,6 +76,6 @@
%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
-%doc README.markdown
+%doc CHANGES.markdown README.markdown
%changelog
++++++ diagrams-solve-0.1.0.1.tar.gz -> diagrams-solve-0.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/diagrams-solve-0.1.0.1/CHANGES.markdown
new/diagrams-solve-0.1.1/CHANGES.markdown
--- old/diagrams-solve-0.1.0.1/CHANGES.markdown 2016-02-14 19:04:55.000000000
+0100
+++ new/diagrams-solve-0.1.1/CHANGES.markdown 2017-07-03 17:23:38.000000000
+0200
@@ -1,3 +1,9 @@
+* 0.1.1 (3 July 2017)
+
+ allow base-4.10 for GHC-8.2
+ some minor optimizations
+ add QC tests
+
* 0.1.0.1 (14 February 2016)
allow base-4.9 for GHC-8.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/diagrams-solve-0.1.0.1/LICENSE
new/diagrams-solve-0.1.1/LICENSE
--- old/diagrams-solve-0.1.0.1/LICENSE 2015-02-27 15:26:20.000000000 +0100
+++ new/diagrams-solve-0.1.1/LICENSE 2017-07-03 17:23:38.000000000 +0200
@@ -1,4 +1,7 @@
-Copyright (c) 2015, various
+Copyright (c) 2015-2016 diagrams-solve team:
+
+ Daniel Bergey <[email protected]>
+ Brent Yorgey <[email protected]>
All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/diagrams-solve-0.1.0.1/diagrams-solve.cabal
new/diagrams-solve-0.1.1/diagrams-solve.cabal
--- old/diagrams-solve-0.1.0.1/diagrams-solve.cabal 2016-02-13
00:42:44.000000000 +0100
+++ new/diagrams-solve-0.1.1/diagrams-solve.cabal 2017-07-03
17:23:38.000000000 +0200
@@ -1,5 +1,5 @@
name: diagrams-solve
-version: 0.1.0.1
+version: 0.1.1
synopsis: Pure Haskell solver routines used by diagrams
description: Pure Haskell solver routines used by the diagrams
project. Currently includes finding real roots
@@ -15,7 +15,7 @@
build-type: Simple
extra-source-files: README.markdown, CHANGES.markdown
cabal-version: >=1.10
-Tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1
+Tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1,
GHC == 8.2.1
Source-repository head
type: git
location: http://github.com/diagrams/diagrams-solve.git
@@ -23,6 +23,20 @@
library
exposed-modules: Diagrams.Solve.Polynomial,
Diagrams.Solve.Tridiagonal
- build-depends: base >=4.5 && < 4.10
+ build-depends: base >=4.5 && < 4.11
hs-source-dirs: src
- default-language: Haskell2010
\ No newline at end of file
+ default-language: Haskell2010
+
+test-suite tests
+ type: exitcode-stdio-1.0
+ main-is: Test.hs
+ -- other-modules: Instances
+ hs-source-dirs: tests
+ default-language: Haskell2010
+ build-depends: base >= 4.2 && < 4.11,
+ tasty >= 0.10 && < 0.12,
+ tasty-hunit >= 0.9.2 && < 0.10,
+ tasty-quickcheck >= 0.8 && < 0.9,
+ deepseq >= 1.3 && < 1.5,
+ diagrams-solve
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/diagrams-solve-0.1.0.1/src/Diagrams/Solve/Polynomial.hs
new/diagrams-solve-0.1.1/src/Diagrams/Solve/Polynomial.hs
--- old/diagrams-solve-0.1.0.1/src/Diagrams/Solve/Polynomial.hs 2015-02-27
15:26:20.000000000 +0100
+++ new/diagrams-solve-0.1.1/src/Diagrams/Solve/Polynomial.hs 2017-07-03
17:23:38.000000000 +0200
@@ -31,12 +31,15 @@
-- c.f. http://comments.gmane.org/gmane.comp.lang.haskell.libraries/21164
-- for discussion. "The choice in (^) and (^^) to overload on the
-- power's Integral type... was a genuinely bad idea." - Edward Kmett
+--
+-- Note there are rewrite rules in GHC.Real to expand small exponents.
(^) :: (Num a) => a -> Integer -> a
(^) = (P.^)
-- | Utility function used to avoid singularities
aboutZero' :: (Ord a, Num a) => a -> a -> Bool
aboutZero' toler x = abs x < toler
+{-# INLINE aboutZero' #-}
------------------------------------------------------------
-- Quadratic formula
@@ -69,6 +72,7 @@
| otherwise = [q/a, c/q]
where d = b^2 - 4*a*c
q = -1/2*(b + signum b * sqrt d)
+{-# INLINE quadForm #-}
_quadForm_prop :: Double -> Double -> Double -> Bool
_quadForm_prop a b c = all (aboutZero' 1e-10 . eval) (quadForm a b c)
@@ -113,12 +117,14 @@
trig k = 2 * sqrt(-p/3) * cos(phi - k*tau/3) - b/(3*a)
cubert x | x < 0 = -((-x)**(1/3))
| otherwise = x**(1/3)
+{-# INLINE cubForm' #-}
-- | Solve the cubic equation ax^3 + bx^2 + cx + d = 0, returning a
-- list of all real roots within 1e-10 tolerance
-- (although currently it's closer to 1e-5)
cubForm :: (Floating d, Ord d) => d -> d -> d -> d -> [d]
cubForm = cubForm' 1e-10
+{-# INLINE cubForm #-}
_cubForm_prop :: Double -> Double -> Double -> Double -> Bool
_cubForm_prop a b c d = all (aboutZero' 1e-5 . eval) (cubForm a b c d)
@@ -177,12 +183,14 @@
v' = if aboutZero' toler v then 0 else sqrt v
s1 = quadForm 1 (if q<0 then -v' else v') (z-u')
s2 = quadForm 1 (if q<0 then v' else -v') (z+u')
+{-# INLINE quartForm' #-}
-- | Solve the quartic equation c4 x^4 + c3 x^3 + c2 x^2 + c1 x + c0 = 0,
returning a
-- list of all real roots within 1e-10 tolerance
-- (although currently it's closer to 1e-5)
quartForm :: (Floating d, Ord d) => d -> d -> d -> d -> d -> [d]
quartForm = quartForm' 1e-10
+{-# INLINE quartForm #-}
_quartForm_prop :: Double -> Double -> Double -> Double -> Double -> Bool
_quartForm_prop a b c d e = all (aboutZero' 1e-5 . eval) (quartForm a b c d e)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/diagrams-solve-0.1.0.1/tests/Test.hs
new/diagrams-solve-0.1.1/tests/Test.hs
--- old/diagrams-solve-0.1.0.1/tests/Test.hs 1970-01-01 01:00:00.000000000
+0100
+++ new/diagrams-solve-0.1.1/tests/Test.hs 2017-07-03 17:23:38.000000000
+0200
@@ -0,0 +1,22 @@
+module Main where
+
+import Diagrams.Solve.Polynomial
+
+import Test.Tasty (defaultMain, testGroup, TestTree)
+import Test.Tasty.QuickCheck
+
+tests :: TestTree
+tests = testGroup "Solve" [
+ testProperty "solutions found satisfy quadratic equation" $
+ \a b c -> let sat x = a * x * x + b * x + c =~ 0 in all sat
(quadForm a b c)
+-- could verify number of solutions, but we would just duplicate the function
definition
+ , testProperty "solutions found satisfy cubic equation" $
+ \a b c d -> let sat x = a * x * x * x + b * x * x + c * x + d =~ (0
:: Double) in all sat (cubForm a b c d)
+ ]
+
+(=~) :: Double -> Double -> Bool
+(=~) a b = abs (a - b) < 0.001
+infix 4 =~
+
+main :: IO ()
+main = defaultMain tests