Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-cborg for openSUSE:Factory 
checked in at 2021-04-24 23:08:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cborg (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-cborg.new.12324 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-cborg"

Sat Apr 24 23:08:57 2021 rev:5 rq:888030 version:0.2.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cborg/ghc-cborg.changes      2020-12-22 
11:37:12.285363931 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-cborg.new.12324/ghc-cborg.changes   
2021-04-24 23:10:07.487477247 +0200
@@ -1,0 +2,9 @@
+Fri Apr  9 08:55:09 UTC 2021 - [email protected]
+
+- Update cborg to version 0.2.5.0.
+  Upstream has edited the change log file since the last release in
+  a non-trivial way, i.e. they did more than just add a new entry
+  at the top. You can review the file at:
+  http://hackage.haskell.org/package/cborg-0.2.5.0/src/ChangeLog.md
+
+-------------------------------------------------------------------

Old:
----
  cborg-0.2.4.0.tar.gz

New:
----
  cborg-0.2.5.0.tar.gz

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

Other differences:
------------------
++++++ ghc-cborg.spec ++++++
--- /var/tmp/diff_new_pack.7WmE73/_old  2021-04-24 23:10:07.895477824 +0200
+++ /var/tmp/diff_new_pack.7WmE73/_new  2021-04-24 23:10:07.899477830 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-cborg
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global pkg_name cborg
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.2.4.0
+Version:        0.2.5.0
 Release:        0
 Summary:        Concise Binary Object Representation (CBOR)
 License:        BSD-3-Clause
@@ -77,8 +77,6 @@
 
 %prep
 %autosetup -n %{pkg_name}-%{version}
-cabal-tweak-dep-ver base '< 4.15' '< 5'
-cabal-tweak-dep-ver ghc-prim '< 0.7' '< 1'
 
 %build
 %ghc_lib_build

++++++ cborg-0.2.4.0.tar.gz -> cborg-0.2.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cborg-0.2.4.0/ChangeLog.md 
new/cborg-0.2.5.0/ChangeLog.md
--- old/cborg-0.2.4.0/ChangeLog.md      2001-09-09 03:46:40.000000000 +0200
+++ new/cborg-0.2.5.0/ChangeLog.md      2001-09-09 03:46:40.000000000 +0200
@@ -1,10 +1,6 @@
 # Revision history for cborg
 
-## 0.2.4.0  -- 2020-07-05
-
-* Performance improvements
-
-## 0.2.3.0  -- 2020-05-10
+## 0.2.3.1  -- 2020-05-10
 
 * Bounds updates for GHC 8.10
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cborg-0.2.4.0/cborg.cabal 
new/cborg-0.2.5.0/cborg.cabal
--- old/cborg-0.2.4.0/cborg.cabal       2001-09-09 03:46:40.000000000 +0200
+++ new/cborg-0.2.5.0/cborg.cabal       2001-09-09 03:46:40.000000000 +0200
@@ -1,5 +1,5 @@
 name:                cborg
-version:             0.2.4.0
+version:             0.2.5.0
 synopsis:            Concise Binary Object Representation (CBOR)
 license:             BSD3
 license-file:        LICENSE.txt
@@ -13,7 +13,7 @@
 build-type:          Simple
 cabal-version:       >= 1.10
 tested-with:
-  GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC 
== 8.6.5, GHC == 8.8.3, GHC == 8.10.1
+  GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC 
== 8.8.3, GHC == 8.10.1, GHC == 9.0.1
 
 extra-source-files:
   ChangeLog.md
@@ -83,11 +83,11 @@
 
   build-depends:
     array                   >= 0.4     && < 0.6,
-    base                    >= 4.7     && < 4.15,
-    bytestring              >= 0.10.4  && < 0.11,
+    base                    >= 4.7     && < 4.16,
+    bytestring              >= 0.10.4  && < 0.12,
     containers              >= 0.5     && < 0.7,
     deepseq                 >= 1.0     && < 1.5,
-    ghc-prim                >= 0.3.1.0 && < 0.7,
+    ghc-prim                >= 0.3.1.0 && < 0.8,
     half                    >= 0.2.2.3 && < 0.4,
     primitive               >= 0.5     && < 0.8,
     text                    >= 1.1     && < 1.3
@@ -100,8 +100,12 @@
   if impl(ghc >= 8.0)
     ghc-options: -Wcompat -Wnoncanonical-monad-instances
   else
-    -- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for 
pre-GHC8
-    build-depends: fail == 4.9.*, semigroups >=0.18 && <0.20
+    build-depends:
+      -- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for 
pre-GHC8
+      fail                    == 4.9.*,
+      semigroups              >= 0.18 && < 0.20,
+      -- the `PS` pattern synonym in bytestring 0.11 is unavailable with GHC < 
8.0
+      bytestring              < 0.11
 
 test-suite tests
   type:              exitcode-stdio-1.0
@@ -134,20 +138,20 @@
 
   build-depends:
     array                   >= 0.4     && < 0.6,
-    base                    >= 4.7     && < 4.15,
+    base                    >= 4.7     && < 4.16,
     base-orphans,
-    bytestring              >= 0.10.4  && < 0.11,
+    bytestring              >= 0.10.4  && < 0.12,
     text                    >= 1.1     && < 1.3,
     cborg,
     aeson                   >= 0.7     && < 1.6,
-    base64-bytestring       >= 1.0     && < 1.2,
-    base16-bytestring       >= 0.1     && < 0.2,
+    base64-bytestring       >= 1.0     && < 1.3,
+    base16-bytestring       >= 1.0     && < 1.1,
     deepseq                 >= 1.0     && < 1.5,
     half                    >= 0.2.2.3 && < 0.4,
     QuickCheck              >= 2.9     && < 2.15,
     random,
     scientific              >= 0.3     && < 0.4,
-    tasty                   >= 0.11    && < 1.4,
+    tasty                   >= 0.11    && < 1.5,
     tasty-hunit             >= 0.9     && < 0.11,
     tasty-quickcheck        >= 0.8     && < 0.11,
     vector                  >= 0.10    && < 0.13
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cborg-0.2.4.0/src/Codec/CBOR/FlatTerm.hs 
new/cborg-0.2.5.0/src/Codec/CBOR/FlatTerm.hs
--- old/cborg-0.2.4.0/src/Codec/CBOR/FlatTerm.hs        2001-09-09 
03:46:40.000000000 +0200
+++ new/cborg-0.2.5.0/src/Codec/CBOR/FlatTerm.hs        2001-09-09 
03:46:40.000000000 +0200
@@ -250,7 +250,7 @@
 
       TypeTag          -> do !x <- decodeTag
                              return $! TkTag (fromIntegral x)
-      TypeTag64        -> do !x <- decodeTag
+      TypeTag64        -> do !x <- decodeTag64
                              return $! TkTag (fromIntegral x)
 
       TypeBool    -> do !x <- decodeBool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cborg-0.2.4.0/src/Codec/CBOR/Read.hs 
new/cborg-0.2.5.0/src/Codec/CBOR/Read.hs
--- old/cborg-0.2.4.0/src/Codec/CBOR/Read.hs    2001-09-09 03:46:40.000000000 
+0200
+++ new/cborg-0.2.5.0/src/Codec/CBOR/Read.hs    2001-09-09 03:46:40.000000000 
+0200
@@ -9,9 +9,14 @@
 {-# LANGUAGE OverloadedStrings      #-}
 {-# LANGUAGE RankNTypes             #-}
 
+#if __GLASGOW_HASKELL__ < 900
 -- Bump up from the default 1.5, otherwise our decoder fast path is no good.
 -- We went over the threshold when we switched to using ST.
+--
+-- However, this flag is not supported on GHC 9.0 and later and eye-balling the
+-- Core suggests that the new inlining heuristics don't require it.
 {-# OPTIONS_GHC -funfolding-keeness-factor=2.0 #-}
+#endif
 
 -- |
 -- Module      : Codec.CBOR.Read
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cborg-0.2.4.0/src/Codec/CBOR/Write.hs 
new/cborg-0.2.5.0/src/Codec/CBOR/Write.hs
--- old/cborg-0.2.4.0/src/Codec/CBOR/Write.hs   2001-09-09 03:46:40.000000000 
+0200
+++ new/cborg-0.2.5.0/src/Codec/CBOR/Write.hs   2001-09-09 03:46:40.000000000 
+0200
@@ -4,6 +4,16 @@
 {-# LANGUAGE MagicHash           #-}
 {-# LANGUAGE RankNTypes          #-}
 {-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE PatternSynonyms     #-}
+
+#include "cbor.h"
+
+#if defined(OPTIMIZE_GMP)
+#if __GLASGOW_HASKELL__ >= 900
+#define HAVE_GHC_BIGNUM 1
+{-# LANGUAGE UnboxedSums         #-}
+#endif
+#endif
 
 -- |
 -- Module      : Codec.CBOR.Write
@@ -22,8 +32,6 @@
   , toStrictByteString -- :: Encoding -> S.ByteString
   ) where
 
-#include "cbor.h"
-
 import           Data.Bits
 import           Data.Int
 
@@ -44,14 +52,22 @@
 import qualified Data.Text                             as T
 import qualified Data.Text.Encoding                    as T
 
-#if defined(OPTIMIZE_GMP)
 import           Control.Exception.Base                (assert)
 import           GHC.Exts
+import           GHC.IO                                (IO(IO))
+#if defined(HAVE_GHC_BIGNUM)
+import qualified GHC.Num.Integer
+import qualified GHC.Num.BigNat                        as Gmp
+import qualified GHC.Num.BigNat
+import           GHC.Num.BigNat                        (BigNat)
+#else
 import qualified GHC.Integer.GMP.Internals             as Gmp
+import           GHC.Integer.GMP.Internals             (BigNat)
+#endif
+
 #if __GLASGOW_HASKELL__ < 710
 import           GHC.Word
 #endif
-#endif
 
 import qualified Codec.CBOR.ByteArray.Sliced           as BAS
 import           Codec.CBOR.Encoding
@@ -129,9 +145,10 @@
           -- This code is specialized for GMP implementation of Integer. By
           -- looking directly at the constructors we can avoid some checks.
           -- S# hold an Int, so we can just use intMP.
-          TkInteger (Gmp.S# i) vs' -> PI.runB intMP (I# i) op >>= go vs'
-          -- Jp# is guaranteed to be > 0.
-          TkInteger integer@(Gmp.Jp# bigNat) vs'
+          TkInteger (SmallInt i) vs' ->
+               PI.runB intMP (I# i) op >>= go vs'
+          -- PosBigInt is guaranteed to be > 0.
+          TkInteger integer@(PosBigInt bigNat) vs'
             | integer <= fromIntegral (maxBound :: Word64) ->
                 PI.runB word64MP (fromIntegral integer) op >>= go vs'
             | otherwise ->
@@ -139,7 +156,7 @@
                in BI.runBuilderWith
                     (bigNatMP bigNat) (buildStep vs' k) buffer
           -- Jn# is guaranteed to be < 0.
-          TkInteger integer@(Gmp.Jn# bigNat) vs'
+          TkInteger integer@(NegBigInt bigNat) vs'
             | integer >= -1 - fromIntegral (maxBound :: Word64) ->
                 PI.runB negInt64MP (fromIntegral (-1 - integer)) op >>= go vs'
             | otherwise ->
@@ -181,7 +198,6 @@
     bound :: Int
     bound = 9
 
-
 header :: P.BoundedPrim Word8
 header = P.liftFixedToBounded P.word8
 
@@ -579,31 +595,87 @@
 -- ---------------------------------------- --
 -- Implementation optimized for integer-gmp --
 -- ---------------------------------------- --
-bigNatMP :: Gmp.BigNat -> B.Builder
+
+-- Below is where we try to abstract over the differences between the legacy
+-- integer-gmp interface and ghc-bignum, shipped in GHC >= 9.0.
+
+-- | Write the limbs of a 'BigNat' to the given address in big-endian byte
+-- ordering.
+exportBigNatToAddr :: BigNat -> Addr# -> IO Word
+
+#if defined(HAVE_GHC_BIGNUM)
+
+pattern SmallInt  n = GHC.Num.Integer.IS n
+pattern PosBigInt n = GHC.Num.Integer.IP n
+pattern NegBigInt n = GHC.Num.Integer.IN n
+
+bigNatSizeInBytes :: GHC.Num.BigNat.BigNat -> Word
+bigNatSizeInBytes bigNat =
+  Gmp.bigNatSizeInBase 256 (GHC.Num.BigNat.unBigNat bigNat)
+
+bigNatMP :: GHC.Num.BigNat.BigNat# -> B.Builder
+bigNatMP n = P.primBounded header 0xc2 <> bigNatToBuilder (GHC.Num.BigNat.BN# 
n)
+
+negBigNatMP :: GHC.Num.BigNat.BigNat# -> B.Builder
+negBigNatMP n =
+  -- If value `n` is stored in CBOR, it is interpreted as -1 - n. Since BigNat
+  -- already represents n (note: it's unsigned), we simply decrement it to get
+  -- the correct encoding.
+     P.primBounded header 0xc3
+  <> bigNatToBuilder (subtractOneBigNat (GHC.Num.BigNat.BN# n))
+  where
+    subtractOneBigNat (GHC.Num.BigNat.BN# nat) =
+      case GHC.Num.BigNat.bigNatSubWord# nat 1## of
+        (#       | r #) -> GHC.Num.BigNat.BN# r
+        (# (# #) | #)   -> error "subtractOneBigNat: impossible"
+
+exportBigNatToAddr (GHC.Num.BigNat.BN# b) addr = IO $ \s ->
+  -- The last parameter (`1#`) makes the export function use big endian 
encoding.
+  case GHC.Num.BigNat.bigNatToAddr# b addr 1# s of
+    (# s', w #) -> (# s', W# w #)
+#else
+
+pattern SmallInt  n = Gmp.S# n
+pattern PosBigInt n = Gmp.Jp# n
+pattern NegBigInt n = Gmp.Jn# n
+
+bigNatSizeInBytes :: BigNat -> Word
+bigNatSizeInBytes bigNat = W# (Gmp.sizeInBaseBigNat bigNat 256#)
+
+bigNatMP :: BigNat -> B.Builder
 bigNatMP n = P.primBounded header 0xc2 <> bigNatToBuilder n
 
-negBigNatMP :: Gmp.BigNat -> B.Builder
+negBigNatMP :: BigNat -> B.Builder
 negBigNatMP n =
   -- If value `n` is stored in CBOR, it is interpreted as -1 - n. Since BigNat
   -- already represents n (note: it's unsigned), we simply decrement it to get
   -- the correct encoding.
      P.primBounded header 0xc3
-  <> bigNatToBuilder (Gmp.minusBigNatWord n (int2Word# 1#))
+  <> bigNatToBuilder (subtractOneBigNat n)
+  where
+    subtractOneBigNat n = Gmp.minusBigNatWord n (int2Word# 1#)
 
-bigNatToBuilder :: Gmp.BigNat -> B.Builder
+exportBigNatToAddr bigNat addr# =
+  -- The last parameter (`1#`) makes the export function use big endian 
encoding.
+  Gmp.exportBigNatToAddr bigNat addr# 1#
+#endif
+
+bigNatToBuilder :: BigNat -> B.Builder
 bigNatToBuilder = bigNatBuilder
   where
-    bigNatBuilder :: Gmp.BigNat -> B.Builder
+    bigNatBuilder :: BigNat -> B.Builder
     bigNatBuilder bigNat =
-        let sizeW# = Gmp.sizeInBaseBigNat bigNat 256#
-            bounded = PI.boudedPrim (I# (word2Int# sizeW#)) (dumpBigNat sizeW#)
-        in P.primBounded bytesLenMP (W# sizeW#) <> P.primBounded bounded bigNat
-
-    dumpBigNat :: Word# -> Gmp.BigNat -> Ptr a -> IO (Ptr a)
-    dumpBigNat sizeW# bigNat ptr@(Ptr addr#) = do
-        -- The last parameter (`1#`) makes the export function use big endian
-        -- encoding.
-        (W# written#) <- Gmp.exportBigNatToAddr bigNat addr# 1#
+        let sizeW = bigNatSizeInBytes bigNat
+#if MIN_VERSION_bytestring(0,10,12)
+            bounded = PI.boundedPrim (fromIntegral sizeW) (dumpBigNat sizeW)
+#else
+            bounded = PI.boudedPrim (fromIntegral sizeW) (dumpBigNat sizeW)
+#endif
+        in P.primBounded bytesLenMP sizeW <> P.primBounded bounded bigNat
+
+    dumpBigNat :: Word -> BigNat -> Ptr a -> IO (Ptr a)
+    dumpBigNat (W# sizeW#) bigNat ptr@(Ptr addr#) = do
+        (W# written#) <- exportBigNatToAddr bigNat addr#
         let !newPtr = ptr `plusPtr` (I# (word2Int# written#))
             sanity = isTrue# (sizeW# `eqWord#` written#)
         return $ assert sanity newPtr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cborg-0.2.4.0/tests/Tests/Reference/TestVectors.hs 
new/cborg-0.2.5.0/tests/Tests/Reference/TestVectors.hs
--- old/cborg-0.2.4.0/tests/Tests/Reference/TestVectors.hs      2001-09-09 
03:46:40.000000000 +0200
+++ new/cborg-0.2.5.0/tests/Tests/Reference/TestVectors.hs      2001-09-09 
03:46:40.000000000 +0200
@@ -44,7 +44,7 @@
       encoded   <- either fail return $
                    Base64.decode encoded64
       encoded16 <- T.encodeUtf8 <$> obj .: "hex"
-      let encoded' = fst (Base16.decode encoded16)
+      let encoded' = Base16.decodeLenient encoded16
       when (encoded /= encoded') $
         fail "hex and cbor encoding mismatch in input"
       roundTrip <- obj .: "roundtrip"

Reply via email to