@@ -216,10 +216,6 @@ take n m = fromStream $ go n (toStream m)
216 yield a (Just x) = yld a (Just (go (n1 - 1) x))
216 yield a (Just x) = yld a (Just (go (n1 - 1) x))
217 in if n1 <= 0 then stp else (runStream m1) ctx stp yield
217 in if n1 <= 0 then stp else (runStream m1) ctx stp yield
219−-- XXX This is not as efficient as it could be. We need a short circuiting at
220−-- a lower level. Compare with simple-conduit, filtering there cuts down time
221−-- due to short circuting whereas the time spent remains the same here.
223-- | Include only those elements that pass a predicate.
219-- | Include only those elements that pass a predicate.
224{-# INLINE filter #-}
220{-# INLINE filter #-}
225filter :: Streaming t => (a -> Bool) -> t m a -> t m a
221filter :: Streaming t => (a -> Bool) -> t m a -> t m a
@@ -256,13 +252,14 @@ drop n m = fromStream $ go n (toStream m)
257-- | Drop elements in the stream as long as the predicate succeeds and then
253-- | Drop elements in the stream as long as the predicate succeeds and then
258-- take the rest of the stream.
254-- take the rest of the stream.
255+{-# INLINE dropWhile #-}
259dropWhile :: Streaming t => (a -> Bool) -> t m a -> t m a
256dropWhile :: Streaming t => (a -> Bool) -> t m a -> t m a
260dropWhile p m = fromStream $ go (toStream m)
257dropWhile p m = fromStream $ go (toStream m)
262 go m1 = Stream $ \ctx stp yld ->
259 go m1 = Stream $ \ctx stp yld ->
263 let yield a Nothing | p a = stp
260 let yield a Nothing | p a = stp
264 | otherwise = yld a Nothing
261 | otherwise = yld a Nothing
265− yield a (Just x) | p a = (runStream (go x)) ctx stp yield
262+ yield a (Just x) | p a = (runStream x) ctx stp yield
266 | otherwise = yld a (Just x)
263 | otherwise = yld a (Just x)
267 in (runStream m1) ctx stp yield
264 in (runStream m1) ctx stp yield