Hello community,

here is the log from the commit of package ghc-memory for openSUSE:Factory 
checked in at 2017-06-12 15:28:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-memory (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-memory.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-memory"

Mon Jun 12 15:28:03 2017 rev:7 rq:494175 version:0.14.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-memory/ghc-memory.changes    2017-03-14 
10:05:31.221099765 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-memory.new/ghc-memory.changes       
2017-06-12 15:28:03.933307473 +0200
@@ -1,0 +2,15 @@
+Wed May  3 08:14:00 UTC 2017 - [email protected]
+
+- Update to version 0.14.5 with cabal2obs.
+
+-------------------------------------------------------------------
+Tue Apr  4 11:04:07 UTC 2017 - [email protected]
+
+- Update to version 0.14.3 with cabal2obs.
+
+-------------------------------------------------------------------
+Mon Mar 27 12:41:49 UTC 2017 - [email protected]
+
+- Update to version 0.14.2 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  memory-0.14.1.tar.gz

New:
----
  memory-0.14.5.tar.gz

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

Other differences:
------------------
++++++ ghc-memory.spec ++++++
--- /var/tmp/diff_new_pack.YVY5Nd/_old  2017-06-12 15:28:04.545221175 +0200
+++ /var/tmp/diff_new_pack.YVY5Nd/_new  2017-06-12 15:28:04.549220611 +0200
@@ -19,7 +19,7 @@
 %global pkg_name memory
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.14.1
+Version:        0.14.5
 Release:        0
 Summary:        Memory and related abstraction stuff
 License:        BSD-3-Clause
@@ -29,6 +29,7 @@
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-deepseq-devel
+BuildRequires:  ghc-foundation-devel
 BuildRequires:  ghc-rpm-macros
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if %{with tests}

++++++ memory-0.14.1.tar.gz -> memory-0.14.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/ByteArray/Bytes.hs 
new/memory-0.14.5/Data/ByteArray/Bytes.hs
--- old/memory-0.14.1/Data/ByteArray/Bytes.hs   2017-01-16 11:16:10.000000000 
+0100
+++ new/memory-0.14.5/Data/ByteArray/Bytes.hs   2017-04-03 14:08:10.000000000 
+0200
@@ -55,9 +55,11 @@
 
 touchBytes :: Bytes -> IO ()
 touchBytes (Bytes mba) = IO $ \s -> case touch# mba s of s' -> (# s', () #)
+{-# INLINE touchBytes #-}
 
 sizeofBytes :: Bytes -> Int
 sizeofBytes (Bytes mba) = I# (sizeofMutableByteArray# mba)
+{-# INLINE sizeofBytes #-}
 
 withPtr :: Bytes -> (Ptr p -> IO a) -> IO a
 withPtr b@(Bytes mba) f = do
@@ -75,23 +77,23 @@
 bytesConcat :: [Bytes] -> IO Bytes
 bytesConcat l = bytesAlloc retLen (copy l)
   where
-    retLen = sum $ map bytesLength l
+    !retLen = sum $ map bytesLength l
 
     copy []     _   = return ()
     copy (x:xs) dst = do
         withPtr x $ \src -> memCopy dst src chunkLen
         copy xs (dst `plusPtr` chunkLen)
       where
-        chunkLen = bytesLength x
+        !chunkLen = bytesLength x
 
 bytesAppend :: Bytes -> Bytes -> IO Bytes
 bytesAppend b1 b2 = bytesAlloc retLen $ \dst -> do
     withPtr b1 $ \s1 -> memCopy dst                  s1 len1
     withPtr b2 $ \s2 -> memCopy (dst `plusPtr` len1) s2 len2
   where
-    len1   = bytesLength b1
-    len2   = bytesLength b2
-    retLen = len1 + len2
+    !len1   = bytesLength b1
+    !len2   = bytesLength b2
+    !retLen = len1 + len2
 
 bytesAllocRet :: Int -> (Ptr p -> IO a) -> IO (a, Bytes)
 bytesAllocRet sz f = do
@@ -101,6 +103,7 @@
 
 bytesLength :: Bytes -> Int
 bytesLength = sizeofBytes
+{-# LANGUAGE bytesLength #-}
 
 withBytes :: Bytes -> (Ptr p -> IO a) -> IO a
 withBytes = withPtr
@@ -122,6 +125,7 @@
                         if booleanPrim (eqWord# e1 e2)
                             then loop (i +# 1#) s''
                             else (# s', False #)
+    {-# INLINE loop #-}
 
 bytesCompare :: Bytes -> Bytes -> Ordering
 bytesCompare b1@(Bytes m1) b2@(Bytes m2) = unsafeDoIO $ IO $ \s -> loop 0# s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/ByteArray/Methods.hs 
new/memory-0.14.5/Data/ByteArray/Methods.hs
--- old/memory-0.14.1/Data/ByteArray/Methods.hs 2015-08-18 12:25:39.000000000 
+0200
+++ new/memory-0.14.5/Data/ByteArray/Methods.hs 2017-03-15 21:52:13.000000000 
+0100
@@ -55,6 +55,7 @@
 alloc n f
     | n < 0     = alloc 0 f
     | otherwise = snd `fmap` allocRet n f
+{-# INLINE alloc #-}
 
 -- | Allocate a new bytearray of specific size, and run the initializer on 
this memory
 create :: ByteArray ba => Int -> (Ptr p -> IO ()) -> IO ba
@@ -70,6 +71,10 @@
 unsafeCreate sz f = unsafeDoIO (alloc sz f)
 {-# NOINLINE unsafeCreate #-}
 
+inlineUnsafeCreate :: ByteArray a => Int -> (Ptr p -> IO ()) -> a
+inlineUnsafeCreate !sz f = unsafeDoIO (alloc sz f)
+{-# INLINE inlineUnsafeCreate #-}
+
 -- | Create an empty byte array
 empty :: ByteArray a => a
 empty = unsafeDoIO (alloc 0 $ \_ -> return ())
@@ -80,9 +85,11 @@
 
 -- | Pack a list of bytes into a bytearray
 pack :: ByteArray a => [Word8] -> a
-pack l = unsafeCreate (Prelude.length l) (fill 0 l)
-  where fill _ []     _ = return ()
-        fill i (x:xs) p = pokeByteOff p i x >> fill (i+1) xs p
+pack l = inlineUnsafeCreate (Prelude.length l) (fill l)
+  where fill []     _  = return ()
+        fill (x:xs) !p = poke p x >> fill xs (p `plusPtr` 1)
+        {-# INLINE fill #-}
+{-# NOINLINE pack #-}
 
 -- | Un-pack a bytearray into a list of bytes
 unpack :: ByteArrayAccess a => a -> [Word8]
@@ -156,8 +163,8 @@
     | n <= 0    = empty
     | otherwise = unsafeCreate m $ \d -> withByteArray bs $ \s -> memCopy d s m
   where
-    m   = min len n
-    len = length bs
+    !m   = min len n
+    !len = length bs
 
 -- | drop the first @n@ byte of a bytearray
 drop :: ByteArray bs => Int -> bs -> bs
@@ -176,8 +183,10 @@
     | null bs   = (bs, bs)
     | otherwise = let n = loop 0 in (take n bs, drop n bs)
   where loop !i
+            | i >= len          = len
             | pred (index bs i) = loop (i+1)
             | otherwise         = i
+        len = length bs
 
 -- | Concatenate bytearray into a larger bytearray
 concat :: (ByteArrayAccess bin, ByteArray bout) => [bin] -> bout
@@ -213,16 +222,17 @@
 -- | Similiar to 'copy' but expect the resulting bytearray in a pure context
 copyAndFreeze :: (ByteArrayAccess bs1, ByteArray bs2) => bs1 -> (Ptr p -> IO 
()) -> bs2
 copyAndFreeze bs f =
-    unsafeCreate (length bs) $ \d -> do
+    inlineUnsafeCreate (length bs) $ \d -> do
         withByteArray bs $ \s -> memCopy d s (length bs)
         f (castPtr d)
+{-# NOINLINE copyAndFreeze #-}
 
 -- | Create a bytearray of a specific size containing a repeated byte value
 replicate :: ByteArray ba => Int -> Word8 -> ba
 replicate 0 _ = empty
 replicate n b
     | n < 0     = empty
-    | otherwise = unsafeCreate n $ \ptr -> memSet ptr b n
+    | otherwise = inlineUnsafeCreate n $ \ptr -> memSet ptr b n
 {-# NOINLINE replicate #-}
 
 -- | Create a bytearray of a specific size initialized to 0
@@ -258,8 +268,8 @@
     | l1 /= l2  = False
     | otherwise = unsafeDoIO $ withByteArray b1 $ \p1 -> withByteArray b2 $ 
\p2 -> memConstEqual p1 p2 l1
   where
-    l1 = length b1
-    l2 = length b2
+    !l1 = length b1
+    !l2 = length b2
 
 -- | Check if any element of a byte array satisfies a predicate
 any :: (ByteArrayAccess ba) => (Word8 -> Bool) -> ba -> Bool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/ByteArray/ScrubbedBytes.hs 
new/memory-0.14.5/Data/ByteArray/ScrubbedBytes.hs
--- old/memory-0.14.1/Data/ByteArray/ScrubbedBytes.hs   2016-12-17 
11:24:07.000000000 +0100
+++ new/memory-0.14.5/Data/ByteArray/ScrubbedBytes.hs   2017-03-15 
21:52:13.000000000 +0100
@@ -73,12 +73,7 @@
                  in case mkWeak# mbarr () (finalize scrubber mba) s1 of
                     (# s2, _ #) -> (# s2, mba #)
   where
-#if __GLASGOW_HASKELL__ > 801
-    finalize :: (State# RealWorld -> State# RealWorld) -> ScrubbedBytes -> 
State# RealWorld -> State# RealWorld
-    finalize scrubber mba@(ScrubbedBytes _) = \s1 ->
-        case scrubber s1 of
-            s2 -> touch# mba s2
-#elif __GLASGOW_HASKELL__ >= 800
+#if __GLASGOW_HASKELL__ >= 800
     finalize :: (State# RealWorld -> State# RealWorld) -> ScrubbedBytes -> 
State# RealWorld -> (# State# RealWorld, () #)
     finalize scrubber mba@(ScrubbedBytes _) = \s1 ->
         case scrubber s1 of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/ByteArray/Types.hs 
new/memory-0.14.5/Data/ByteArray/Types.hs
--- old/memory-0.14.1/Data/ByteArray/Types.hs   2015-05-18 11:01:29.000000000 
+0200
+++ new/memory-0.14.5/Data/ByteArray/Types.hs   2017-04-25 14:59:24.000000000 
+0200
@@ -6,6 +6,7 @@
 -- Portability : Good
 --
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE BangPatterns #-}
 module Data.ByteArray.Types
     ( ByteArrayAccess(..)
     , ByteArray(..)
@@ -19,6 +20,12 @@
 import qualified Data.ByteString.Internal as B
 import           Foreign.ForeignPtr (withForeignPtr)
 #endif
+#ifdef WITH_FOUNDATION_SUPPORT
+import qualified Foundation as F
+import qualified Foundation.Collection as F
+import qualified Foundation.String as F (toBytes, Encoding(UTF8))
+import qualified Foundation.Array.Internal as F
+#endif
 
 -- | Class to Access size properties and data of a ByteArray
 class ByteArrayAccess ba where
@@ -34,8 +41,7 @@
 #ifdef WITH_BYTESTRING_SUPPORT
 instance ByteArrayAccess B.ByteString where
     length = B.length
-    withByteArray b f = withForeignPtr fptr $ \ptr -> f (ptr `plusPtr` off)
-      where (fptr, off, _) = B.toForeignPtr b
+    withByteArray (B.PS fptr off _) f = withForeignPtr fptr $ \ptr -> f $! 
(ptr `plusPtr` off)
 
 instance ByteArray B.ByteString where
     allocRet sz f = do
@@ -44,3 +50,22 @@
         return (r, B.PS fptr 0 sz)
 #endif
 
+#ifdef WITH_FOUNDATION_SUPPORT
+uarrayRecastW8 :: F.PrimType ty => F.UArray ty -> F.UArray F.Word8
+uarrayRecastW8 = F.recast
+
+instance F.PrimType ty => ByteArrayAccess (F.UArray ty) where
+    length = F.length . uarrayRecastW8
+    withByteArray a f = F.withPtr (uarrayRecastW8 a) (f . castPtr)
+
+instance ByteArrayAccess F.String where
+    length = F.length
+    withByteArray s f = withByteArray (F.toBytes F.UTF8 s) f
+
+instance (Ord ty, F.PrimType ty) => ByteArray (F.UArray ty) where
+    allocRet sz f = do
+        mba <- F.new (F.Size sz)
+        a   <- F.withMutablePtr mba (f . castPtr)
+        ba  <- F.unsafeFreeze mba
+        return (a, ba)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/Memory/Internal/CompatPrim.hs 
new/memory-0.14.5/Data/Memory/Internal/CompatPrim.hs
--- old/memory-0.14.1/Data/Memory/Internal/CompatPrim.hs        2016-01-12 
22:00:31.000000000 +0100
+++ new/memory-0.14.5/Data/Memory/Internal/CompatPrim.hs        2017-02-04 
10:41:17.000000000 +0100
@@ -69,6 +69,7 @@
 booleanPrim :: Bool -> Bool
 booleanPrim b = b
 #endif
+{-# INLINE booleanPrim #-}
 
 -- | Apply or or another function if 8 divides the number of bytes
 eitherDivideBy8# :: Int#        -- ^ number of bytes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/Memory/Internal/Scrubber.hs 
new/memory-0.14.5/Data/Memory/Internal/Scrubber.hs
--- old/memory-0.14.1/Data/Memory/Internal/Scrubber.hs  2016-01-12 
22:38:22.000000000 +0100
+++ new/memory-0.14.5/Data/Memory/Internal/Scrubber.hs  2017-02-06 
12:28:06.000000000 +0100
@@ -26,29 +26,35 @@
     | otherwise                = scrubBytes sz
   where
         scrub4 a = \s -> writeWord32OffAddr# a 0# 0## s
+        {-# INLINE scrub4 #-}
 #if WORD_SIZE_IN_BITS == 64
         scrub8 a = \s -> writeWord64OffAddr# a 0# 0## s
+        {-# INLINE scrub8 #-}
         scrub16 a = \s1 ->
             let !s2 = writeWord64OffAddr# a 0# 0## s1
                 !s3 = writeWord64OffAddr# a 1# 0## s2
              in s3
+        {-# INLINE scrub16 #-}
         scrub32 a = \s1 ->
             let !s2 = writeWord64OffAddr# a 0# 0## s1
                 !s3 = writeWord64OffAddr# a 1# 0## s2
                 !s4 = writeWord64OffAddr# a 2# 0## s3
                 !s5 = writeWord64OffAddr# a 3# 0## s4
              in s5
+        {-# INLINE scrub32 #-}
 #else
         scrub8 a = \s1 ->
             let !s2 = writeWord32OffAddr# a 0# 0## s1
                 !s3 = writeWord32OffAddr# a 1# 0## s2
              in s3
+        {-# INLINE scrub8 #-}
         scrub16 a = \s1 ->
             let !s2 = writeWord32OffAddr# a 0# 0## s1
                 !s3 = writeWord32OffAddr# a 1# 0## s2
                 !s4 = writeWord32OffAddr# a 2# 0## s3
                 !s5 = writeWord32OffAddr# a 3# 0## s4
              in s5
+        {-# INLINE scrub16 #-}
         scrub32 a = \s1 ->
             let !s2 = writeWord32OffAddr# a 0# 0## s1
                 !s3 = writeWord32OffAddr# a 1# 0## s2
@@ -59,6 +65,7 @@
                 !s8 = writeWord32OffAddr# a 6# 0## s7
                 !s9 = writeWord32OffAddr# a 7# 0## s8
              in s9
+        {-# INLINE scrub32 #-}
 #endif
 
 scrubBytes :: Int# -> Addr# -> State# RealWorld -> State# RealWorld
@@ -69,3 +76,5 @@
             | otherwise              =
                 case writeWord8OffAddr# a 0# 0## s of
                     s' -> loop (n -# 1#) (plusAddr# a 1#) s'
+        {-# INLINE loop #-}
+{-# INLINE scrubBytes #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/Data/Memory/PtrMethods.hs 
new/memory-0.14.5/Data/Memory/PtrMethods.hs
--- old/memory-0.14.1/Data/Memory/PtrMethods.hs 2015-11-15 11:41:12.000000000 
+0100
+++ new/memory-0.14.5/Data/Memory/PtrMethods.hs 2017-04-25 17:02:31.000000000 
+0200
@@ -24,7 +24,7 @@
 
 import           Data.Memory.Internal.Imports
 import           Foreign.Ptr              (Ptr, plusPtr)
-import           Foreign.Storable         (peek, poke, pokeByteOff, 
peekByteOff)
+import           Foreign.Storable         (peek, poke, peekByteOff)
 import           Foreign.C.Types
 import           Foreign.Marshal.Alloc    (allocaBytesAligned)
 import           Data.Bits                ((.|.), xor)
@@ -48,21 +48,29 @@
 --
 -- d = replicate (sizeof s) v `xor` s
 memXorWith :: Ptr Word8 -> Word8 -> Ptr Word8 -> Int -> IO ()
-memXorWith d v s n = loop 0
+memXorWith destination !v source bytes
+    | destination == source = loopInplace source bytes
+    | otherwise             = loop destination source bytes
   where
-    loop i
-        | i == n    = return ()
-        | otherwise = do
-            (xor v <$> peekByteOff s i) >>= pokeByteOff d i
-            loop (i+1)
+    loop _   _  0 = return ()
+    loop !d !s !n = do
+        peek s >>= poke d . xor v
+        loop (d `plusPtr` 1) (s `plusPtr` 1) (n-1)
+
+    loopInplace _   0 = return ()
+    loopInplace !s !n = do
+        peek s >>= poke s . xor v
+        loopInplace (s `plusPtr` 1) (n-1)
 
 -- | Copy a set number of bytes from @src to @dst
 memCopy :: Ptr Word8 -> Ptr Word8 -> Int -> IO ()
 memCopy dst src n = c_memcpy dst src (fromIntegral n)
+{-# INLINE memCopy #-}
 
 -- | Set @n number of bytes to the same value @v
 memSet :: Ptr Word8 -> Word8 -> Int -> IO ()
-memSet start v n = c_memset start (fromIntegral v) (fromIntegral n) >>= \_ -> 
return ()
+memSet start v n = c_memset start v (fromIntegral n) >>= \_ -> return ()
+{-# INLINE memSet #-}
 
 -- | Check if two piece of memory are equals
 memEqual :: Ptr Word8 -> Ptr Word8 -> Int -> IO Bool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/memory.cabal 
new/memory-0.14.5/memory.cabal
--- old/memory-0.14.1/memory.cabal      2017-01-16 11:22:48.000000000 +0100
+++ new/memory-0.14.5/memory.cabal      2017-04-25 17:02:36.000000000 +0200
@@ -1,5 +1,5 @@
 Name:                memory
-Version:             0.14.1
+Version:             0.14.5
 Synopsis:            memory and related abstraction stuff
 Description:
     Chunk of memory, polymorphic byte array management and manipulation
@@ -37,6 +37,11 @@
   Default:           True
   Manual:            True
 
+Flag support_foundation
+  Description:       add support for foundation strings and unboxed array
+  Default:           True
+  Manual:            True
+
 Flag support_deepseq
   Description:       add deepseq instances for memory types
   Default:           True
@@ -89,6 +94,9 @@
   if flag(support_deepseq)
     CPP-options:     -DWITH_DEEPSEQ_SUPPORT
     Build-depends:   deepseq >= 1.1
+  if flag(support_foundation)
+    CPP-options:     -DWITH_FOUNDATION_SUPPORT
+    Build-depends:   foundation >= 0.0.8
 
   ghc-options:       -Wall -fwarn-tabs
   default-language:  Haskell2010
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/memory-0.14.1/tests/Tests.hs 
new/memory-0.14.5/tests/Tests.hs
--- old/memory-0.14.1/tests/Tests.hs    2017-01-16 11:16:10.000000000 +0100
+++ new/memory-0.14.5/tests/Tests.hs    2017-03-15 21:52:13.000000000 +0100
@@ -202,4 +202,14 @@
              in B.any p b1 == any p l
         , testProperty "singleton b == pack [b]" $ \b ->
             witnessID (B.singleton b) == B.pack [b]
+        , testProperty "span" $ \x (Words8 l) ->
+            let c = witnessID (B.pack l)
+                (a, b) = B.span (== x) c
+             in c == B.append a b
+        , testProperty "span (const True)" $ \(Words8 l) ->
+            let a = witnessID (B.pack l)
+             in B.span (const True) a == (a, B.empty)
+        , testProperty "span (const False)" $ \(Words8 l) ->
+            let b = witnessID (B.pack l)
+             in B.span (const False) b == (B.empty, b)
         ]


Reply via email to