Hello community,

here is the log from the commit of package ghc-digits for openSUSE:Factory 
checked in at 2016-11-10 13:24:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-digits (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-digits.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-digits"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-digits/ghc-digits.changes    2016-11-02 
12:31:22.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-digits.new/ghc-digits.changes       
2016-11-10 13:24:08.000000000 +0100
@@ -1,0 +2,5 @@
+Thu Sep 15 06:35:58 UTC 2016 - [email protected]
+
+- Update to version 0.3.1 revision 0 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  digits-0.2.tar.gz

New:
----
  digits-0.3.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-digits.spec ++++++
--- /var/tmp/diff_new_pack.U2ryeL/_old  2016-11-10 13:24:09.000000000 +0100
+++ /var/tmp/diff_new_pack.U2ryeL/_new  2016-11-10 13:24:09.000000000 +0100
@@ -17,20 +17,19 @@
 
 
 %global pkg_name digits
+%bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.2
+Version:        0.3.1
 Release:        0
 Summary:        Converts integers to lists of digits and back
 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-QuickCheck-devel
 BuildRequires:  ghc-rpm-macros
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
 
 %description
 Converts integers to lists of digits and back.
@@ -49,14 +48,14 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
+%check
+%cabal_test
 
 %post devel
 %ghc_pkg_recache

++++++ digits-0.2.tar.gz -> digits-0.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/digits-0.2/LICENSE new/digits-0.3.1/LICENSE
--- old/digits-0.2/LICENSE      2009-12-20 14:25:36.000000000 +0100
+++ new/digits-0.3.1/LICENSE    2016-07-08 22:41:02.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (c) 2009, Henry Bucklow
+Copyright (c) 2009-2016, Henry Bucklow, Charlie Harvey
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/digits-0.2/digits.cabal new/digits-0.3.1/digits.cabal
--- old/digits-0.2/digits.cabal 2009-12-20 14:25:36.000000000 +0100
+++ new/digits-0.3.1/digits.cabal       2016-07-08 22:41:02.000000000 +0200
@@ -1,19 +1,35 @@
-Build-Type: Custom
+Build-Type: Simple
 Name: digits
 Category: Data
-Version: 0.2
-Cabal-Version: >= 1.2
+Version: 0.3.1
+Cabal-Version: >= 1.10
 Synopsis: Converts integers to lists of digits and back.
 Description: Converts integers to lists of digits and back.
 License: BSD3
 License-File: LICENSE
-Copyright: (c) 2009 Henry Bucklow
+Copyright: (c) 2009-2016 Henry Bucklow, Charlie Harvey
 Author: Henry Bucklow
 Maintainer: [email protected]
-Tested-With: GHC==6.12
-Build-Depends: base >= 4 && < 5, QuickCheck
-Exposed-Modules: Data.Digits
-Hs-Source-Dirs: src
-Extra-Source-Files: src/Tests.hs
-GHC-Options: -Wall
+Tested-With: GHC==7.10.3
 
+library
+  hs-source-dirs:      src
+  exposed-modules:     Data.Digits
+  build-depends:       base >= 4.7 && < 5
+                     , QuickCheck
+  default-language:    Haskell2010
+
+test-suite digits-test
+  type:                exitcode-stdio-1.0
+  hs-source-dirs:      test
+                     , src
+  main-is:             Tests.hs
+  build-depends:       base
+                     , digits
+                     , QuickCheck
+  ghc-options:         -Wall -threaded -rtsopts -with-rtsopts=-N
+  default-language:    Haskell2010
+
+source-repository head
+  type:     mercurial
+  location: https://bitbucket.org/sffubs/digits
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/digits-0.2/src/Data/Digits.hs 
new/digits-0.3.1/src/Data/Digits.hs
--- old/digits-0.2/src/Data/Digits.hs   2009-12-20 14:25:36.000000000 +0100
+++ new/digits-0.3.1/src/Data/Digits.hs 2016-07-08 22:41:02.000000000 +0200
@@ -1,36 +1,60 @@
-module Data.Digits (digits, digitsRev, unDigits, prop_digitsRoundTrip) where
+module Data.Digits (mDigits, digits, mDigitsRev, digitsRev, unDigits, 
prop_digitsRoundTrip) where
 
 import Test.QuickCheck
+import Data.Maybe (fromJust)
+import Data.List (genericTake)
 
--- | Returns the digits of a positive integer as a list, in reverse order.
+-- | Returns the digits of a positive integer as a Maybe list, in reverse order
+--   or Nothing if a zero or negative base is given
 --   This is slightly more efficient than in forward order.
-digitsRev :: Integral n
+mDigitsRev :: Integral n
+    => n         -- ^ The base to use.
+    -> n         -- ^ The number to convert to digit form.
+    -> Maybe [n] -- ^ Nothing or Just the digits of the number in list form, 
in reverse.
+mDigitsRev base i = if base < 1
+                    then Nothing -- We do not support zero or negative bases
+                    else Just $ dr base i
+    where
+      dr _ 0 = []
+      dr b x = case base of
+                1 -> genericTake x $ repeat 1
+                _ -> let (rest, lastDigit) = quotRem x b
+                     in lastDigit : dr b rest
+
+-- | Returns the digits of a positive integer as a Maybe list.
+--   or Nothing if a zero or negative base is given
+mDigits :: Integral n
     => n -- ^ The base to use.
     -> n -- ^ The number to convert to digit form.
-    -> [n] -- ^ The digits of the number in list form, in reverse.
-digitsRev base i = case i of
-        0 -> []
-        _ -> lastDigit : digitsRev base rest
-    where (rest, lastDigit) = quotRem i base
+    -> Maybe [n] -- ^ Nothing or Just the digits of the number in list form
+mDigits base i = reverse <$> mDigitsRev base i
+
+-- | Returns the digits of a positive integer as a list, in reverse order.
+--   Throws an error if given a zero or negative base.
+digitsRev :: Integral n
+    => n   -- ^ The base to use.
+    -> n   -- ^ The number to convert to digit from.
+    -> [n] -- ^ The digits of the number in list from, in reverse.
+digitsRev base = fromJust . mDigitsRev base
 
 -- | Returns the digits of a positive integer as a list.
+--   Throws an error if given a zero or negative base.
 digits :: Integral n
-    => n -- ^ The base to use (typically 10).
-    -> n -- ^ The number to convert to digit form.
-    -> [n] -- ^ The digits of the number in list form.
+    => n   -- ^ The base to use (typically 10).
+    -> n   -- ^ The number to convert to digit form.
+    -> [n] -- ^ Either Nothing or the digits of the number in list form.
 digits base = reverse . digitsRev base
 
 -- | Takes a list of digits, and converts them back into a positive integer.
 unDigits :: Integral n
-    => n -- ^ The base to use.
+    => n   -- ^ The base to use.
     -> [n] -- ^ The digits of the number in list form.
-    -> n -- ^ The original number.
+    -> n   -- ^ The original number.
 unDigits base = foldl (\ a b -> a * base + b) 0
 
--- | unDigits . digits should be the identity, in any base.
+-- | unDigits . digits should be the identity, in any positive base.
 prop_digitsRoundTrip
     :: Integer -- ^ The integer to test.
     -> Integer -- ^ The base to use.
     -> Property
-prop_digitsRoundTrip i b = i > 0 ==> b > 1 ==> i == (unDigits b . digits b) i
-
+prop_digitsRoundTrip i b = i > 0 ==> b > 0 ==> i == (unDigits b . digits b) i
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/digits-0.2/src/Tests.hs new/digits-0.3.1/src/Tests.hs
--- old/digits-0.2/src/Tests.hs 2009-12-20 14:25:36.000000000 +0100
+++ new/digits-0.3.1/src/Tests.hs       1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-module Main where
-
-import Data.Digits
-import Text.Printf
-import Test.QuickCheck
-
-tests = [
-    ("checkDigitsRoundTrip", quickCheck prop_digitsRoundTrip)]
-
-main = mapM_ (\(s,a) -> printf "%-25s: " s >> a) tests
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/digits-0.2/test/Tests.hs 
new/digits-0.3.1/test/Tests.hs
--- old/digits-0.2/test/Tests.hs        1970-01-01 01:00:00.000000000 +0100
+++ new/digits-0.3.1/test/Tests.hs      2016-07-08 22:41:02.000000000 +0200
@@ -0,0 +1,13 @@
+module Main where
+
+import Data.Digits
+import Text.Printf
+import Test.QuickCheck
+
+tests :: [([Char], IO ())]
+tests = [
+    ("checkDigitsRoundTrip", quickCheck prop_digitsRoundTrip)]
+
+main :: IO ()
+main = mapM_ (\(s,a) -> printf "%-25s: " s >> a) tests
+


Reply via email to