File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
vector-stream/src/Data/Stream Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -387,15 +387,19 @@ take n (Stream step t) = n `seq` Stream step' (t, 0)
387
387
-- | All but the first @n@ elements
388
388
drop :: Monad m => Int -> Stream m a -> Stream m a
389
389
{-# INLINE_FUSED drop #-}
390
- drop n (Stream step t) = Stream ( step' n) t
390
+ drop n (Stream step t) = Stream step' (t, n)
391
391
where
392
392
{-# INLINE_INNER step' #-}
393
- step' i s | i > 0 = do
394
- r <- step s
395
- case r of
396
- Yield _ s' -> step' (i - 1 ) s'
397
- Done -> return Done
398
- | otherwise = step s
393
+ step' (s, i) | i > 0 = do
394
+ r <- step s
395
+ case r of
396
+ Yield _ s' -> step' (s', i - 1 )
397
+ Done -> return Done
398
+ | otherwise = liftM (\ r ->
399
+ case r of
400
+ Yield x s' -> Yield x (s', i)
401
+ Done -> Done
402
+ ) (step s)
399
403
400
404
401
405
-- Mapping
You can’t perform that action at this time.
0 commit comments