@@ -335,22 +335,6 @@ import Streamly.Internal.Data.Stream.StreamD.Flatten
335335import Streamly.Internal.Data.Stream.StreamD.SplitGroup
336336import Streamly.Internal.Data.SVar
337337
338−-------------------------------------------------------------------------------
339−-- Deconstruction
340−-------------------------------------------------------------------------------
341−
342−-- Does not fuse, has the same performance as the StreamK version.
343−{-# INLINE_NORMAL uncons #-}
344−uncons :: Monad m => Stream m a -> m (Maybe (a, Stream m a))
345−uncons (UnStream step state) = go state
346− where
347− go st = do
348− r <- step defState st
349− case r of
350− Yield x s -> return $ Just (x, Stream step s)
351− Skip s -> go s
352− Stop -> return Nothing
353−
354338-------------------------------------------------------------------------------
355339-- Hoisting the inner monad
356340-------------------------------------------------------------------------------
@@ -423,22 +407,6 @@ runStateT initial (Stream step state) = Stream step' (state, initial)
423407 Skip s -> Skip (s, return sv')
424408 Stop -> Stop
425409
426−------------------------------------------------------------------------------
427−-- Elimination by Folds
428−------------------------------------------------------------------------------
429−
430−------------------------------------------------------------------------------
431−-- Right Folds
432−------------------------------------------------------------------------------
433−
434−{-# INLINE_NORMAL foldr1 #-}
435−foldr1 :: Monad m => (a -> a -> a) -> Stream m a -> m (Maybe a)
436−foldr1 f m = do
437− r <- uncons m
438− case r of
439− Nothing -> return Nothing
440− Just (h, t) -> fmap Just (foldr f h t)
441−
442410------------------------------------------------------------------------------
443411-- Substreams
444412------------------------------------------------------------------------------