@@ -680,7 +680,7 @@ yieldM = K.yieldM
680680-- @since 0.6.0
681681{-# INLINE fromIndices #-}
682682fromIndices :: (IsStream t, Monad m) => (Int -> a) -> t m a
683−fromIndices = fromStreamD . D.fromIndices
683+fromIndices = fromStreamS . S.fromIndices
684684
685685--
686686-- |
@@ -691,13 +691,17 @@ fromIndices = fromStreamD . D.fromIndices
691691-- Generate an infinite stream, whose values are the output of a monadic
692692-- function @f@ applied on the corresponding index. Index starts at 0.
693693--
694+-- /Concurrent/
695+--
694696-- @since 0.6.0
695−{-# INLINE fromIndicesM #-}
697+{-# INLINE_EARLY fromIndicesM #-}
696698fromIndicesM :: (IsStream t, MonadAsync m) => (Int -> m a) -> t m a
697−fromIndicesM gen = go 0
698− where
699− go i = K.mkStream $ \st stp sng yld -> do
700− K.foldStreamShared st stp sng yld (gen i |: go (i + 1))
699+fromIndicesM = K.fromIndicesM
700+
701+{-# RULES "fromIndicesM serial" fromIndicesM = fromIndicesMSerial #-}
702+{-# INLINE fromIndicesMSerial #-}
703+fromIndicesMSerial :: MonadAsync m => (Int -> m a) -> SerialT m a
704+fromIndicesMSerial = fromStreamS . S.fromIndicesM
701705
702706-- |
703707-- @