Hello community, here is the log from the commit of package ghc-memory for openSUSE:Factory checked in at 2017-06-20 09:41:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-memory (Old) and /work/SRC/openSUSE:Factory/.ghc-memory.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-memory" Tue Jun 20 09:41:04 2017 rev:8 rq:504775 version:0.14.6 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-memory/ghc-memory.changes 2017-06-12 15:28:03.933307473 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-memory.new/ghc-memory.changes 2017-06-20 09:41:04.910260751 +0200 @@ -1,0 +2,5 @@ +Mon Jun 12 09:41:40 UTC 2017 - [email protected] + +- Update to version 0.14.6. + +------------------------------------------------------------------- Old: ---- memory-0.14.5.tar.gz New: ---- memory-0.14.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-memory.spec ++++++ --- /var/tmp/diff_new_pack.90c7xV/_old 2017-06-20 09:41:05.574167144 +0200 +++ /var/tmp/diff_new_pack.90c7xV/_new 2017-06-20 09:41:05.574167144 +0200 @@ -19,7 +19,7 @@ %global pkg_name memory %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.14.5 +Version: 0.14.6 Release: 0 Summary: Memory and related abstraction stuff License: BSD-3-Clause ++++++ memory-0.14.5.tar.gz -> memory-0.14.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.14.5/CHANGELOG.md new/memory-0.14.6/CHANGELOG.md --- old/memory-0.14.5/CHANGELOG.md 2017-01-16 11:24:02.000000000 +0100 +++ new/memory-0.14.6/CHANGELOG.md 2017-06-09 23:17:40.000000000 +0200 @@ -1,3 +1,26 @@ +## 0.14.6 + +* Fix allocRet using unit of bytes but using as unit of ty directly without adaptation + +## 0.14.5 + +* Fix bug in memXorWith not working as advertised if source different from destination + +## 0.14.4 + +* Add support for foundation uarray creation +* optimise memXorWith + +## 0.14.3 + +* Add support for foundation uarray peeking + +## 0.14.2 + +* Fix use of ghc 8.2 touch +* Prevent span from reading past buffer +* cleanup .prof spam + ## 0.14.1 * Fix `Show` instance of Bytes (Oliver Chéron) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.14.5/Data/ByteArray/Types.hs new/memory-0.14.6/Data/ByteArray/Types.hs --- old/memory-0.14.5/Data/ByteArray/Types.hs 2017-04-25 14:59:24.000000000 +0200 +++ new/memory-0.14.6/Data/ByteArray/Types.hs 2017-06-09 23:16:37.000000000 +0200 @@ -25,6 +25,7 @@ import qualified Foundation.Collection as F import qualified Foundation.String as F (toBytes, Encoding(UTF8)) import qualified Foundation.Array.Internal as F +import qualified Foundation.Primitive as F #endif -- | Class to Access size properties and data of a ByteArray @@ -36,7 +37,12 @@ -- | Class to allocate new ByteArray of specific size class (Eq ba, Ord ba, Monoid ba, ByteArrayAccess ba) => ByteArray ba where - allocRet :: Int -> (Ptr p -> IO a) -> IO (a, ba) + -- | allocate `n` bytes and perform the given operation + allocRet :: Int + -- ^ number of bytes to allocate. i.e. might not match the + -- size of the given type `ba`. + -> (Ptr p -> IO a) + -> IO (a, ba) #ifdef WITH_BYTESTRING_SUPPORT instance ByteArrayAccess B.ByteString where @@ -55,17 +61,46 @@ uarrayRecastW8 = F.recast instance F.PrimType ty => ByteArrayAccess (F.UArray ty) where +#if MIN_VERSION_foundation(0,0,10) + length a = let F.CountOf i = F.length (uarrayRecastW8 a) in i +#else length = F.length . uarrayRecastW8 +#endif withByteArray a f = F.withPtr (uarrayRecastW8 a) (f . castPtr) instance ByteArrayAccess F.String where - length = F.length +#if MIN_VERSION_foundation(0,0,10) + length str = let F.CountOf i = F.length bytes in i +#else + length str = F.length bytes +#endif + where + -- the Foundation's length return a number of elements not a number of + -- bytes. For @ByteArrayAccess@, because we are using an @Int@, we + -- didn't see that we were returning the wrong @CountOf@. + bytes = F.toBytes F.UTF8 str 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) + mba <- F.new $ sizeRecastBytes sz F.Proxy a <- F.withMutablePtr mba (f . castPtr) ba <- F.unsafeFreeze mba return (a, ba) + where +#if MIN_VERSION_foundation(0,0,10) + sizeRecastBytes :: F.PrimType ty => Int -> F.Proxy ty -> F.CountOf ty + sizeRecastBytes w p = F.CountOf $ + let (q,r) = w `Prelude.quotRem` szTy + in q + (if r == 0 then 0 else 1) + where !(F.CountOf szTy) = F.primSizeInBytes p + {-# INLINE [1] sizeRecastBytes #-} +#else + sizeRecastBytes :: F.PrimType ty => Int -> F.Proxy ty -> F.Size ty + sizeRecastBytes w p = F.Size $ + let (q,r) = w `Prelude.quotRem` szTy + in q + (if r == 0 then 0 else 1) + where !(F.Size szTy) = F.primSizeInBytes p + {-# INLINE [1] sizeRecastBytes #-} +#endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.14.5/memory.cabal new/memory-0.14.6/memory.cabal --- old/memory-0.14.5/memory.cabal 2017-04-25 17:02:36.000000000 +0200 +++ new/memory-0.14.6/memory.cabal 2017-06-09 23:18:07.000000000 +0200 @@ -1,5 +1,5 @@ Name: memory -Version: 0.14.5 +version: 0.14.6 Synopsis: memory and related abstraction stuff Description: Chunk of memory, polymorphic byte array management and manipulation @@ -19,7 +19,7 @@ License-file: LICENSE Copyright: Vincent Hanquez <[email protected]> Author: Vincent Hanquez <[email protected]> -Maintainer: [email protected] +Maintainer: [email protected], Nicolas Di Prima <[email protected]> Category: memory Stability: experimental Build-Type: Simple @@ -115,3 +115,6 @@ , memory ghc-options: -Wall -fno-warn-orphans -fno-warn-missing-signatures -threaded default-language: Haskell2010 + if flag(support_foundation) + CPP-options: -DWITH_FOUNDATION_SUPPORT + Build-depends: foundation >= 0.0.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.14.5/tests/Tests.hs new/memory-0.14.6/tests/Tests.hs --- old/memory-0.14.5/tests/Tests.hs 2017-03-15 21:52:13.000000000 +0100 +++ new/memory-0.14.6/tests/Tests.hs 2017-06-09 23:16:37.000000000 +0200 @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE Rank2Types #-} module Main where @@ -13,6 +14,10 @@ import qualified SipHash +#ifdef WITH_FOUNDATION_SUPPORT +import qualified Foundation as F +#endif + data Backend = BackendByte | BackendScrubbedBytes deriving (Show,Eq,Bounded,Enum) @@ -161,6 +166,9 @@ ] , testShowProperty "showing" $ \witnessID expectedShow (Words8 l) -> (show . witnessID . B.pack $ l) == expectedShow l +#ifdef WITH_FOUNDATION_SUPPORT + , testFoundationTypes +#endif ] where basicProperties witnessID = @@ -213,3 +221,20 @@ let b = witnessID (B.pack l) in B.span (const False) b == (B.empty, b) ] + +#ifdef WITH_FOUNDATION_SUPPORT +testFoundationTypes = testGroup "Foundation" + [ testCase "allocRet 4 _ :: F.UArray Int8 === 4" $ do + x <- (B.length :: F.UArray F.Int8 -> Int) . snd <$> B.allocRet 4 (const $ return ()) + assertEqual "" 4 x + , testCase "allocRet 4 _ :: F.UArray Int16 === 4" $ do + x <- (B.length :: F.UArray F.Int16 -> Int) . snd <$> B.allocRet 4 (const $ return ()) + assertEqual "" 4 x + , testCase "allocRet 4 _ :: F.UArray Int32 === 4" $ do + x <- (B.length :: F.UArray F.Int32 -> Int) . snd <$> B.allocRet 4 (const $ return ()) + assertEqual "" 4 x + , testCase "allocRet 4 _ :: F.UArray Int64 === 8" $ do + x <- (B.length :: F.UArray F.Int64 -> Int) . snd <$> B.allocRet 4 (const $ return ()) + assertEqual "" 8 x + ] +#endif
