conduit-combinators 1.0.1.1 → 1.0.2
raw patch · 5 files changed
+22/−18 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Conduit: [runIdentity] :: Identity a -> a
+ Conduit: runIdentity :: Identity a -> a
Files
- ChangeLog.md +4/−0
- Data/Conduit/Combinators.hs +9/−9
- Data/Conduit/Combinators/Stream.hs +7/−7
- Data/Conduit/Combinators/Unqualified.hs +1/−1
- conduit-combinators.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+# 1.0.2++* Make mapAccumWhile & mapAccumS strict in accumulator state [#18](https://github.com/fpco/conduit-combinators/pull/18)+ # 1.0.1 * mapAccumWhile, mapAccumWhileM, mapAccumS
Data/Conduit/Combinators.hs view
@@ -1513,7 +1513,7 @@ loop seed' STREAMING(scanl, scanlC, scanlS, f x) --- | 'mapWhile' with a break condition dependent on an accumulator.+-- | 'mapWhile' with a break condition dependent on a strict accumulator. -- Equivalently, 'CL.mapAccum' as long as the result is @Right@. Instead of -- producing a leftover, the breaking input determines the resulting -- accumulator via @Left@.@@ -1524,9 +1524,9 @@ mapAccumWhileC f = loop where- loop s = await >>= maybe (return s) go+ loop !s = await >>= maybe (return s) go where- go a = either return (\(s', b) -> yield b >> loop s') $ f a s+ go a = either (return $!) (\(s', b) -> yield b >> loop s') $ f a s {-# INLINE mapAccumWhileC #-} STREAMING(mapAccumWhile, mapAccumWhileC, mapAccumWhileS, f s) @@ -1780,9 +1780,9 @@ mapAccumWhileMC f = loop where- loop s = await >>= maybe (return s) go+ loop !s = await >>= maybe (return s) go where- go a = lift (f a s) >>= either return (\(s', b) -> yield b >> loop s')+ go a = lift (f a s) >>= either (return $!) (\(s', b) -> yield b >> loop s') {-# INLINE mapAccumWhileMC #-} STREAMING(mapAccumWhileM, mapAccumWhileMC, mapAccumWhileMS, f s) @@ -2027,8 +2027,8 @@ else writeMutVar ref $! S idx' mv front {-# INLINE addE #-} --- | Consume a source in a way piecewise defined by a controlling stream. The--- latter will be evaluated until it terminates.+-- | Consume a source with a strict accumulator, in a way piecewise defined by+-- a controlling stream. The latter will be evaluated until it terminates. -- -- >>> let f a s = liftM (:s) $ mapC (*a) =$ CL.take a -- >>> reverse $ runIdentity $ yieldMany [0..3] $$ mapAccumS f [] (yieldMany [1..])@@ -2037,8 +2037,8 @@ mapAccumS f s xs = do (zs, u) <- loop (newResumableSource xs, s) lift (closeResumableSource zs) >> return u- where loop r@(ys, t) = await >>= maybe (return r) go- where go a = lift (ys $$++ f a t) >>= loop+ where loop r@(ys, !t) = await >>= maybe (return r) go+ where go a = lift (ys $$++ f a t) >>= loop {-# INLINE mapAccumS #-} -- | Run a consuming conduit repeatedly, only stopping when there is no more
Data/Conduit/Combinators/Stream.hs view
@@ -314,14 +314,14 @@ mapAccumWhileS f initial (Stream step ms0) = Stream step' (liftM (initial, ) ms0) where- step' (accum, s) = do+ step' (!accum, s) = do res <- step s return $ case res of Stop () -> Stop accum Skip s' -> Skip (accum, s') Emit s' x -> case f x accum of- Right (accum', r) -> Emit (accum', s') r- Left accum' -> Stop accum'+ Right (!accum', r) -> Emit (accum', s') r+ Left !accum' -> Stop accum' {-# INLINE mapAccumWhileS #-} mapAccumWhileMS :: Monad m =>@@ -329,16 +329,16 @@ mapAccumWhileMS f initial (Stream step ms0) = Stream step' (liftM (initial, ) ms0) where- step' (accum, s) = do+ step' (!accum, s) = do res <- step s case res of Stop () -> return $ Stop accum Skip s' -> return $ Skip (accum, s') Emit s' x -> do lr <- f x accum- case lr of- Right (accum', r) -> return $ Emit (accum', s') r- Left accum' -> return $ Stop accum'+ return $ case lr of+ Right (!accum', r) -> Emit (accum', s') r+ Left !accum' -> Stop accum' {-# INLINE mapAccumWhileMS #-} data IntersperseState a s
Data/Conduit/Combinators/Unqualified.hs view
@@ -1128,7 +1128,7 @@ scanlC = CC.scanl {-# INLINE scanlC #-} --- | 'mapWhileC' with a break condition dependent on an accumulator.+-- | 'mapWhileC' with a break condition dependent on a strict accumulator. -- Equivalently, 'CL.mapAccum' as long as the result is @Right@. Instead of -- producing a leftover, the breaking input determines the resulting -- accumulator via @Left@.
conduit-combinators.cabal view
@@ -1,5 +1,5 @@ name: conduit-combinators-version: 1.0.1.1+version: 1.0.2 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