@@ -122,10 +122,12 @@ unfoldrM step = fromStream . go
122each :: (Streaming t, Foldable f) => f a -> t m a
122each :: (Streaming t, Foldable f) => f a -> t m a
123each = Prelude.foldr cons nil
123each = Prelude.foldr cons nil
125+-- | Iterate a pure function from a seed value, streaming the results forever
125iterate :: Streaming t => (a -> a) -> a -> t m a
126iterate :: Streaming t => (a -> a) -> a -> t m a
126−iterate f = fromStream . go
127+iterate step = fromStream . go
128− go s = scons s (Just (go (f s)))
129+ go s = scons s (Just (go (step s)))
130-- | Read lines from an IO Handle into a stream of Strings.
132-- | Read lines from an IO Handle into a stream of Strings.
131fromHandle :: (Streaming t, MonadIO m) => IO.Handle -> t m String
133fromHandle :: (Streaming t, MonadIO m) => IO.Handle -> t m String