conduit-combinators 0.3.0 → 0.3.0.1
raw patch · 4 files changed
+59/−32 lines, 4 filesdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Data/Conduit/Combinators.hs +50/−23
- Data/Conduit/Combinators/Internal.hs +2/−2
- conduit-combinators.cabal +1/−1
- fusion-macros.h +6/−6
Data/Conduit/Combinators.hs view
@@ -297,7 +297,7 @@ -> Producer m (Element mono) yieldManyC = ofoldMap yield {-# INLINE yieldManyC #-}-STREAMING(yieldMany, x)+STREAMING(yieldMany, yieldManyC, yieldManyS, x) -- | Generate a producer from a seed value. --@@ -371,7 +371,7 @@ -> Producer m a repeatMC m = forever $ lift m >>= yield {-# INLINE repeatMC #-}-STREAMING(repeatM, m)+STREAMING(repeatM, repeatMC, repeatMS, m) -- | Repeatedly run the given action and yield all values it produces, until -- the provided predicate returns @False@.@@ -389,7 +389,7 @@ loop = do x <- lift m when (f x) $ yield x >> loop-STREAMING(repeatWhileM, m f)+STREAMING(repeatWhileM, repeatWhileMC, repeatWhileMS, m f) -- | Perform the given action n times, yielding each result. --@@ -430,7 +430,7 @@ then return () else yield x >> loop {-# INLINEABLE sourceHandleC #-}-STREAMING(sourceHandle, h)+STREAMING(sourceHandle, sourceHandleC, sourceHandleS, h) -- | Open a @Handle@ using the given function and stream data from it. --@@ -648,7 +648,7 @@ await >>= maybe (return Nothing) loop where loop prev = await >>= maybe (return $ Just prev) (loop . f prev)-STREAMING(foldl1, f)+STREAMING(foldl1, foldl1C, foldl1S, f) -- | A strict left fold on a chunked stream, with no starting value. -- Returns 'Nothing' when the stream is empty.@@ -687,7 +687,7 @@ -> Consumer a m Bool allC f = fmap isNothing $ find (Prelude.not . f) {-# INLINE allC #-}-STREAMING(all, f)+STREAMING(all, allC, allS, f) -- | Check that all elements in the chunked stream return True. --@@ -715,7 +715,7 @@ -> Consumer a m Bool anyC = fmap isJust . find {-# INLINE anyC #-}-STREAMING(any, f)+STREAMING(any, anyC, anyS, f) -- | Check that at least one element in the chunked stream returns True. --@@ -749,7 +749,12 @@ -- Since 1.0.0 andE :: (Monad m, MonoFoldable mono, Element mono ~ Bool) => Consumer mono m Bool+#if __GLASGOW_HASKELL__ >= 706 INLINE_RULE0(andE, allE id)+#else+andE = allE id+{-# INLINE andE #-}+#endif -- | Are any values in the stream True? --@@ -770,7 +775,12 @@ -- Since 1.0.0 orE :: (Monad m, MonoFoldable mono, Element mono ~ Bool) => Consumer mono m Bool+#if __GLASGOW_HASKELL__ >= 706 INLINE_RULE0(orE, anyE id)+#else+orE = anyE id+{-# INLINE orE #-}+#endif -- | Are any values in the stream equal to the given value? --@@ -829,7 +839,7 @@ => Consumer strict m lazy sinkLazyC = (fromChunks . ($ [])) <$> CL.fold (\front next -> front . (next:)) id {-# INLINE sinkLazyC #-}-STREAMING0(sinkLazy)+STREAMING0(sinkLazy, sinkLazyC, sinkLazyS) -- | Consume all values from the stream and return as a list. Note that this -- will pull all values into memory.@@ -867,7 +877,7 @@ go maxSize (i + 1) mv go initSize 0 mv0 {-# INLINEABLE sinkVectorC #-}-STREAMING0(sinkVector)+STREAMING0(sinkVector, sinkVectorC, sinkVectorS) -- | Sink incoming values into a vector, up until size @maxSize@. Subsequent -- values will be left in the stream. If there are less than @maxSize@ values@@ -894,7 +904,7 @@ go (i + 1) go 0 {-# INLINEABLE sinkVectorNC #-}-STREAMING(sinkVectorN, maxSize)+STREAMING(sinkVectorN, sinkVectorNC, sinkVectorNS, maxSize) -- | Convert incoming values to a builder and fold together all builder values. --@@ -925,7 +935,7 @@ => Consumer a m lazy sinkLazyBuilderC = fmap builderToLazy sinkBuilder {-# INLINE sinkLazyBuilderC #-}-STREAMING0(sinkLazyBuilder)+STREAMING0(sinkLazyBuilder, sinkLazyBuilderC, sinkLazyBuilderS) -- | Consume and discard all remaining values in the stream. --@@ -996,7 +1006,7 @@ await >>= maybe (return Nothing) loop where loop prev = await >>= maybe (return $ Just prev) loop-STREAMING0(last)+STREAMING0(last, lastC, lastS) -- | Retrieve the last element in the chunked stream, if present. --@@ -1008,7 +1018,7 @@ awaitNonNull >>= maybe (return Nothing) (loop . NonNull.last) where loop prev = awaitNonNull >>= maybe (return $ Just prev) (loop . NonNull.last)-STREAMING0(lastE)+STREAMING0(lastE, lastEC, lastES) -- | Count how many values are in the stream. --@@ -1143,7 +1153,7 @@ loop = await >>= maybe (return Nothing) go go x = if f x then return (Just x) else loop {-# INLINE findC #-}-STREAMING(find, f)+STREAMING(find, findC, findS, f) -- | Apply the action to all values in the stream. --@@ -1295,7 +1305,7 @@ -> Conduit a m (Element mono) concatMapC f = awaitForever (yieldMany . f) {-# INLINE concatMapC #-}-STREAMING(concatMap, f)+STREAMING(concatMap, concatMapC, concatMapS, f) -- | Apply the function to each element in the chunked stream, resulting in a -- foldable value (e.g., a list). Then yield each of the individual values in@@ -1432,7 +1442,7 @@ concat, concatC :: (Monad m, MonoFoldable mono) => Conduit mono m (Element mono) concatC = awaitForever yieldMany-STREAMING0(concat)+STREAMING0(concat, concatC, concatS) -- | Keep only values in the stream passing a given predicate. --@@ -1498,7 +1508,7 @@ let seed' = f seed b seed' `seq` yield seed loop seed'-STREAMING(scanl, f x)+STREAMING(scanl, scanlC, scanlS, f x) -- | 'concatMap' with an accumulator. --@@ -1518,7 +1528,7 @@ await >>= omapM_ go where go y = yield y >> concatMap (\z -> [x, z])-STREAMING(intersperse, x)+STREAMING(intersperse, intersperseC, intersperseS, x) -- | Sliding window of values -- 1,2,3,4,5 with window size 2 gives@@ -1542,7 +1552,7 @@ case m of Nothing -> yield st Just x -> go (n-1) (Seq.snoc st x)-STREAMING(slidingWindow, sz)+STREAMING(slidingWindow, slidingWindowC, slidingWindowS, sz) codeWith :: Monad m => Int@@ -1685,7 +1695,7 @@ => (a -> m mono) -> Conduit a m (Element mono) concatMapMC f = awaitForever (lift . f >=> yieldMany)-STREAMING(concatMapM, f)+STREAMING(concatMapM, concatMapMC, concatMapMS, f) -- | Keep only values in the stream passing a given monadic predicate. --@@ -1701,7 +1711,7 @@ go x = do b <- lift $ f x when b $ yield x-STREAMING(filterM, f)+STREAMING(filterM, filterMC, filterMS, f) -- | Keep only elements in the chunked stream passing a given monadic predicate. --@@ -1740,7 +1750,7 @@ seed' <- lift $ f seed b seed' `seq` yield seed loop seed'-STREAMING(scanlM, f x)+STREAMING(scanlM, scanlMC, scanlMS, f x) -- | 'concatMapM' with an accumulator. --@@ -1824,7 +1834,12 @@ -- -- Since 1.0.0 unlines :: (Monad m, Seq.IsSequence seq, Element seq ~ Char) => Conduit seq m seq+#if __GLASGOW_HASKELL__ >= 706 INLINE_RULE0(unlines, concatMap (:[Seq.singleton '\n']))+#else+unlines = concatMap (:[Seq.singleton '\n'])+{-# INLINE unlines #-}+#endif -- | Same as 'unlines', but operates on ASCII/binary data. --@@ -1832,7 +1847,11 @@ -- -- Since 1.0.0 unlinesAscii :: (Monad m, Seq.IsSequence seq, Element seq ~ Word8) => Conduit seq m seq+#if __GLASGOW_HASKELL__ >= 706 INLINE_RULE0(unlinesAscii, concatMap (:[Seq.singleton 10]))+#else+unlinesAscii = concatMap (:[Seq.singleton 10])+#endif -- | Split a stream of arbitrarily-chunked data, based on a predicate -- on elements. Elements that satisfy the predicate will cause chunks@@ -1858,7 +1877,7 @@ else yield x >> loop (Seq.drop 1 y) where (x, y) = Seq.break f t-STREAMING(splitOnUnboundedE, f)+STREAMING(splitOnUnboundedE, splitOnUnboundedEC, splitOnUnboundedES, f) -- | Convert a stream of arbitrarily-chunked textual data into a stream of data -- where each chunk represents a single line. Note that, if you have@@ -1870,7 +1889,11 @@ -- Since 1.0.0 linesUnbounded :: (Monad m, Seq.IsSequence seq, Element seq ~ Char) => Conduit seq m seq+#if __GLASGOW_HASKELL__ >= 706 INLINE_RULE0(linesUnbounded, splitOnUnboundedE (== '\n'))+#else+linesUnbounded = splitOnUnboundedE (== '\n')+#endif -- | Same as 'linesUnbounded', but for ASCII/binary data. --@@ -1879,7 +1902,11 @@ -- Since 1.0.0 linesUnboundedAscii :: (Monad m, Seq.IsSequence seq, Element seq ~ Word8) => Conduit seq m seq+#if __GLASGOW_HASKELL__ >= 706 INLINE_RULE0(linesUnboundedAscii, splitOnUnboundedE (== 10))+#else+linesUnboundedAscii = splitOnUnboundedE (== 10)+#endif -- | Generally speaking, yielding values from inside a Conduit requires -- some allocation for constructors. This can introduce an overhead,
Data/Conduit/Combinators/Internal.hs view
@@ -30,7 +30,7 @@ seed <- lift mseed replicateM_ cnt (lift (f seed) >>= yield) {-# INLINE [1] initReplicateC #-}-STREAMING(initReplicate, mseed f cnt)+STREAMING(initReplicate, initReplicateC, initReplicateS, mseed f cnt) -- | Optimized version of initReplicate for the special case of connecting with -- a @Sink@.@@ -73,7 +73,7 @@ seed <- lift mseed forever $ lift (f seed) >>= yield {-# INLINE [1] initRepeatC #-}-STREAMING(initRepeat, mseed f)+STREAMING(initRepeat, initRepeatC, initRepeatS, mseed f) -- | Optimized version of initRepeat for the special case of connecting with -- a @Sink@.
conduit-combinators.cabal view
@@ -1,5 +1,5 @@ name: conduit-combinators-version: 0.3.0+version: 0.3.0.1 synopsis: Commonly used conduit functions, for both chunked and unchunked data description: Provides a replacement for Data.Conduit.List, as well as a convenient Conduit module. homepage: https://github.com/fpco/conduit-combinators
fusion-macros.h view
@@ -8,16 +8,16 @@ {-# INLINE [0] new #-} ;\ {-# RULES "inline new" forall vars. new vars = body #-} -#define STREAMING0(name) ;\- name = name/**/C ;\+#define STREAMING0(name, nameC, nameS) ;\+ name = nameC ;\ {-# INLINE [0] name #-} ;\ {-# RULES "unstream name" \- name = unstream (streamConduit name/**/C name/**/S) \+ name = unstream (streamConduit nameC nameS) \ #-} -#define STREAMING(name,vars) ;\- name = name/**/C ;\+#define STREAMING(name, nameC, nameS, vars) ;\+ name = nameC ;\ {-# INLINE [0] name #-} ;\ {-# RULES "unstream name" forall vars. \- name vars = unstream (streamConduit (name/**/C vars) (name/**/S vars)) \+ name vars = unstream (streamConduit (nameC vars) (nameS vars)) \ #-}