Hello community,

here is the log from the commit of package ghc-async-extra for openSUSE:Factory 
checked in at 2017-08-31 20:50:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-async-extra (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-async-extra.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-async-extra"

Thu Aug 31 20:50:07 2017 rev:2 rq:513203 version:0.2.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-async-extra/ghc-async-extra.changes  
2017-04-12 18:05:08.331937445 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-async-extra.new/ghc-async-extra.changes     
2017-08-31 20:50:09.064612644 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:07:40 UTC 2017 - psim...@suse.com
+
+- Update to version 0.2.0.0.
+
+-------------------------------------------------------------------

Old:
----
  async-extra-0.1.0.0.tar.gz

New:
----
  async-extra-0.2.0.0.tar.gz

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

Other differences:
------------------
++++++ ghc-async-extra.spec ++++++
--- /var/tmp/diff_new_pack.G5sYk2/_old  2017-08-31 20:50:10.408424013 +0200
+++ /var/tmp/diff_new_pack.G5sYk2/_new  2017-08-31 20:50:10.412423452 +0200
@@ -18,7 +18,7 @@
 
 %global pkg_name async-extra
 Name:           ghc-%{pkg_name}
-Version:        0.1.0.0
+Version:        0.2.0.0
 Release:        0
 Summary:        Useful concurrent combinators
 License:        MIT
@@ -27,9 +27,9 @@
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-async-devel
-BuildRequires:  ghc-containers-devel
 BuildRequires:  ghc-deepseq-devel
 BuildRequires:  ghc-rpm-macros
+BuildRequires:  ghc-split-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description

++++++ async-extra-0.1.0.0.tar.gz -> async-extra-0.2.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-extra-0.1.0.0/async-extra.cabal 
new/async-extra-0.2.0.0/async-extra.cabal
--- old/async-extra-0.1.0.0/async-extra.cabal   2017-01-08 23:45:28.000000000 
+0100
+++ new/async-extra-0.2.0.0/async-extra.cabal   2017-05-28 02:20:54.000000000 
+0200
@@ -1,5 +1,5 @@
 name:                async-extra
-version:             0.1.0.0
+version:             0.2.0.0
 synopsis:            Useful concurrent combinators
 description:         Various concurrent combinators
 homepage:            https://github.com/agrafix/async-extra#readme
@@ -20,8 +20,8 @@
   exposed-modules:     Control.Concurrent.Async.Extra
   build-depends:       base >= 4.8 && < 5,
                        async,
-                       containers >= 0.5,
-                       deepseq >= 1.4
+                       deepseq >= 1.4,
+                       split >= 0.2
   default-language:    Haskell2010
 
 source-repository head
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/async-extra-0.1.0.0/src/Control/Concurrent/Async/Extra.hs 
new/async-extra-0.2.0.0/src/Control/Concurrent/Async/Extra.hs
--- old/async-extra-0.1.0.0/src/Control/Concurrent/Async/Extra.hs       
2017-01-08 23:57:21.000000000 +0100
+++ new/async-extra-0.2.0.0/src/Control/Concurrent/Async/Extra.hs       
2017-05-28 02:20:49.000000000 +0200
@@ -1,10 +1,12 @@
-{-# LANGUAGE BangPatterns #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 module Control.Concurrent.Async.Extra
     ( -- * concurrent mapping
       mapConcurrentlyBounded
+    , mapConcurrentlyBounded_
     , mapConcurrentlyBatched
+    , mapConcurrentlyBatched_
     , mapConcurrentlyChunks
+    , mapConcurrentlyChunks_
       -- * merge strategies
     , mergeConcatAll
     )
@@ -13,11 +15,16 @@
 import Control.Concurrent.Async
 import Control.DeepSeq
 import Control.Exception
-import Data.List
-import Data.Sequence (Seq)
+import Control.Monad
+import Data.List.Split (chunksOf)
 import qualified Control.Concurrent.QSem as S
 import qualified Data.Foldable as F
-import qualified Data.Sequence as Seq
+
+-- | Span a green thread for each task, but only execute N tasks
+-- concurrently. Ignore the result
+mapConcurrentlyBounded_ :: Traversable t => Int -> (a -> IO ()) -> t a -> IO ()
+mapConcurrentlyBounded_ bound action =
+    void . mapConcurrentlyBounded bound action
 
 -- | Span a green thread for each task, but only execute N tasks
 -- concurrently.
@@ -29,40 +36,39 @@
        mapConcurrently wrappedAction items
 
 -- | Span green threads to perform N (batch size) tasks in one thread
+-- and ignore results
+mapConcurrentlyBatched_ ::
+    (Foldable t) => Int -> (a -> IO ()) -> t a -> IO ()
+mapConcurrentlyBatched_ batchSize =
+    mapConcurrentlyBatched batchSize (const $ pure ())
+
+-- | Span green threads to perform N (batch size) tasks in one thread
 -- and merge results using provided merge function
 mapConcurrentlyBatched ::
     (NFData b, Foldable t)
-    => Int -> (Seq (Seq b) -> IO r) -> (a -> IO b) -> t a -> IO r
+    => Int -> ([[b]] -> IO r) -> (a -> IO b) -> t a -> IO r
 mapConcurrentlyBatched batchSize merge action items =
-    do let chunks = chunkList batchSize $ F.toList items
+    do let chunks = chunksOf batchSize $ F.toList items
        r <- mapConcurrently (\x -> force <$> mapM action x) chunks
        merge r
 
 -- | Split input into N chunks with equal length and work on
+-- each chunk in a dedicated green thread. Ignore results
+mapConcurrentlyChunks_ :: (Foldable t) => Int -> (a -> IO ()) -> t a -> IO ()
+mapConcurrentlyChunks_ chunkCount =
+    mapConcurrentlyChunks chunkCount (const $ pure ())
+
+-- | Split input into N chunks with equal length and work on
 -- each chunk in a dedicated green thread. Then merge results using provided 
merge function
 mapConcurrentlyChunks ::
     (NFData b, Foldable t)
-    => Int -> (Seq (Seq b) -> IO r) -> (t a -> Int) -> (a -> IO b) -> t a -> 
IO r
-mapConcurrentlyChunks chunkCount merge getLength action items =
-    do let listSize = getLength items
+    => Int -> ([[b]] -> IO r) -> (a -> IO b) -> t a -> IO r
+mapConcurrentlyChunks chunkCount merge action items =
+    do let listSize = F.length items
            batchSize :: Double
            batchSize = fromIntegral listSize / fromIntegral chunkCount
        mapConcurrentlyBatched (ceiling batchSize) merge action items
 
--- | Chunk a list into chunks of N elements at maximum
-chunkList :: forall a. Int -> [a] -> Seq (Seq a)
-chunkList chunkSize =
-    go 0 Seq.empty
-    where
-      go :: Int -> Seq a -> [a] -> Seq (Seq a)
-      go !size !chunk q
-          | size == chunkSize =
-                Seq.singleton chunk Seq.>< go 0 Seq.empty q
-          | otherwise =
-                case q of
-                  [] -> Seq.singleton chunk
-                  (x : xs) -> go (size + 1) (chunk Seq.|> x) xs
-
--- | Merge all chunks by combining to one list
-mergeConcatAll :: Seq (Seq a) -> [a]
-mergeConcatAll = F.toList . foldl' (Seq.><) Seq.empty . F.toList
+-- | Merge all chunks by combining to one list. (Equiv to 'join')
+mergeConcatAll :: [[a]] -> [a]
+mergeConcatAll = join


Reply via email to