potoki-core 2.2.12 → 2.2.13
raw patch · 3 files changed
+16/−7 lines, 3 files
Files
- library/Potoki/Core/Transform/Basic.hs +13/−4
- library/Potoki/Core/Transform/Concurrency.hs +2/−2
- potoki-core.cabal +1/−1
library/Potoki/Core/Transform/Basic.hs view
@@ -93,12 +93,21 @@ in loop {-|-Chunk to vectors of the given size.-Useful as a precursor of 'concurrently' in cases where the lifted transform's iteration is too light.+Alias to "batch". -}-{-# INLINABLE chunk #-}+{-# DEPRECATED chunk "Use 'batch' instead" #-} chunk :: Int -> Transform a (Vector a)-chunk size = if size < 1+chunk = batch++{-|+Chunk the stream to vector batches of the given size.++It's useful in combination with 'concurrently' in cases where the lifted transform's iteration is too light.+Actually, there is a composed variation of 'concurrently', which utilizes it: 'concurrentlyWithBatching'.+-}+{-# INLINABLE batch #-}+batch :: Int -> Transform a (Vector a)+batch size = if size < 1 then Transform $ const $ liftIO $ return $ empty else Transform $ \ (Fetch fetch) -> liftIO $ do mvec <- MutableGenericVector.new size
library/Potoki/Core/Transform/Concurrency.hs view
@@ -154,6 +154,6 @@ concurrentlyWithBatching :: Int -> Int -> Transform a b -> Transform a b concurrentlyWithBatching batching concurrency transform =- chunk batching >>> bufferize concurrency >>>- unsafeConcurrently concurrency (vector >>> transform >>> chunk batching) >>>+ batch batching >>> bufferize concurrency >>>+ unsafeConcurrently concurrency (vector >>> transform >>> batch batching) >>> vector
potoki-core.cabal view
@@ -1,5 +1,5 @@ name: potoki-core-version: 2.2.12+version: 2.2.13 synopsis: Low-level components of "potoki" description: Provides everything required for building custom instances of