@@ -87,6 +87,7 @@ module Streamly.Internal.Data.Unfold
87 , identity
87 , identity
89 , replicateM
89 , replicateM
90 , fromList
91 , fromList
91 , fromListM
92 , fromListM
92 , enumerateFromStepIntegral
93 , enumerateFromStepIntegral
@@ -404,6 +405,15 @@ replicateM n = Unfold step inject
404 then Stop
405 then Stop
405 else Yield x (x, (i - 1))
406 else Yield x (x, (i - 1))
408+-- | Generates an infinite stream repeating the seed.
410+{-# INLINE repeatM #-}
411+repeatM :: Monad m => Unfold m a a
412+repeatM = Unfold step return
414+ {-# INLINE_LATE step #-}
415+ step x = return $ Yield x x
407-- | Convert a list of pure values to a 'Stream'
417-- | Convert a list of pure values to a 'Stream'
408{-# INLINE_LATE fromList #-}
418{-# INLINE_LATE fromList #-}
409fromList :: Monad m => Unfold m [a] a
419fromList :: Monad m => Unfold m [a] a