@@ -1518,10 +1518,10 @@ elemIndices a = findIndices (== a)
1518-- XXX this is not a one-to-one map so calling it map may not be right.
1518-- XXX this is not a one-to-one map so calling it map may not be right.
1519-- We can perhaps call it zipWithTail or rollWith.
1519-- We can perhaps call it zipWithTail or rollWith.
1521−-- | Apply a function on every two successive elements of a stream. If the
1521+-- | Apply a function on every two successive elements of a stream. The first
1522−-- stream consists of a single element the output is an empty stream.
1522+-- argument of the map function is the previous element and the second argument
1523−--
1523+-- is the current element. When the current element is the first element, the
1524−-- This is the stream equivalent of the list idiom @zipWith f xs (tail xs)@.
1524+-- previous element is 'Nothing'.
1526-- /Pre-release/
1526-- /Pre-release/
@@ -1537,6 +1537,13 @@ rollingMap f m = fromStreamD $ D.rollingMap f $ toStreamD m
1537rollingMapM :: (IsStream t, Monad m) => (Maybe a -> a -> m b) -> t m a -> t m b
1537rollingMapM :: (IsStream t, Monad m) => (Maybe a -> a -> m b) -> t m a -> t m b
1538rollingMapM f m = fromStreamD $ D.rollingMapM f $ toStreamD m
1538rollingMapM f m = fromStreamD $ D.rollingMapM f $ toStreamD m
1540+-- | Like 'rollingMap' but requires at least two elements in the stream,
1541+-- returns an empty stream otherwise.
1543+-- This is the stream equivalent of the list idiom @zipWith f xs (tail xs)@.
1540{-# INLINE rollingMap2 #-}
1547{-# INLINE rollingMap2 #-}
1541rollingMap2 :: (IsStream t, Monad m) => (a -> a -> b) -> t m a -> t m b
1548rollingMap2 :: (IsStream t, Monad m) => (a -> a -> b) -> t m a -> t m b
1542rollingMap2 f m = fromStreamD $ D.rollingMap2 f $ toStreamD m
1549rollingMap2 f m = fromStreamD $ D.rollingMap2 f $ toStreamD m