@@ -100,7 +100,9 @@ module Streamly.Internal.Data.Fold
100100 , runStep
101101
102102 -- * Output Transformations
103+ , rsequence
103104 , sequence
105+ , rmapM
104106 , mapM
105107
106108 -- * Input Transformations
@@ -366,10 +368,10 @@ generally = hoist (return . runIdentity)
366368
367369-- | Flatten the monadic output of a fold to pure output.
368370--
369−-- @since 0.7.0
370−{-# INLINE sequence #-}
371−sequence :: Monad m => Fold m a (m b) -> Fold m a b
372−sequence (Fold step initial extract) = Fold step' initial1 extract'
371+-- @since 0.8.0
372+{-# INLINE rsequence #-}
373+rsequence :: Monad m => Fold m a (m b) -> Fold m a b
374+rsequence (Fold step initial extract) = Fold step' initial1 extract'
373375
374376 where
375377
@@ -384,12 +386,28 @@ sequence (Fold step initial extract) = Fold step' initial1 extract'
384386
385387 extract' = join . extract
386388
389+-- | Flatten the monadic output of a fold to pure output.
390+--
391+-- @since 0.7.0
392+{-# DEPRECATED sequence "Use rsequence instead" #-}
393+{-# INLINE sequence #-}
394+sequence :: Monad m => Fold m a (m b) -> Fold m a b
395+sequence = rsequence
396+
397+-- | Map a monadic function on the output of a fold.
398+--
399+-- @since 0.8.0
400+{-# INLINE rmapM #-}
401+rmapM :: Monad m => (b -> m c) -> Fold m a b -> Fold m a c
402+rmapM f = sequence . fmap f
403+
387404-- | Map a monadic function on the output of a fold.
388405--
389406-- @since 0.7.0
407+{-# DEPRECATED mapM "Use rmapM instead" #-}
390408{-# INLINE mapM #-}
391409mapM :: Monad m => (b -> m c) -> Fold m a b -> Fold m a c
392−mapM f = sequence . fmap f
410+mapM = rmapM
393411
394412-- | @mapMaybe f fold@ maps a 'Maybe' returning function @f@ on the input of
395413-- the fold, filters out 'Nothing' elements, and return the values extracted