@@ -92,7 +92,7 @@ module Streamly.Internal.Data.Stream.Concurrent
9292
9393 -- ** Reactive
9494 , fromCallback
95− , tapCountD
95+ , parTapCount
9696 , tapCount
9797 )
9898where
@@ -726,14 +726,30 @@ fromCallback setCallback = Stream.concatEffect $ do
726726 setCallback callback
727727 return stream
728728
729−{-# INLINE_NORMAL tapCountD #-}
730−tapCountD
729+-- | @parTapCount predicate fold stream@ taps the count of those elements in
730+-- the stream that pass the @predicate@. The resulting count stream is sent to
731+-- a @fold@ running concurrently in another thread.
732+--
733+-- For example, to print the count of elements processed every second:
734+--
735+-- >>> rate = Stream.rollingMap2 (flip (-)) . Stream.delayPost 1
736+-- >>> report = Stream.fold (Fold.drainMapM print) . rate
737+-- >>> tap = Stream.parTapCount (const True) report
738+-- >>> go = Stream.fold Fold.drain $ tap $ Stream.enumerateFrom 0
739+--
740+-- Note: This may not work correctly on 32-bit machines because of Int
741+-- overflow.
742+--
743+-- /Pre-release/
744+--
745+{-# INLINE_NORMAL parTapCount #-}
746+parTapCount
731747 :: MonadAsync m
732748 => (a -> Bool)
733749 -> (D.Stream m Int -> m b)
734750 -> D.Stream m a
735751 -> D.Stream m a
736−tapCountD predicate fld (D.Stream step state) = D.Stream step' Nothing
752+parTapCount predicate fld (D.Stream step state) = D.Stream step' Nothing
737753 where
738754
739755 {-# INLINE_LATE step' #-}
@@ -759,22 +775,9 @@ tapCountD predicate fld (D.Stream step state) = D.Stream step' Nothing
759775 liftIO $ killThread tid
760776 return Stop
761777
762−-- | @tapCount predicate fold stream@ taps the count of those elements in the
763−-- stream that pass the @predicate@. The resulting count stream is sent to
764−-- another thread which folds it using @fold@.
765−--
766−-- For example, to print the count of elements processed every second:
767−--
768−-- >>> rate = Stream.rollingMap2 (flip (-)) . Stream.delayPost 1
769−-- >>> report = Stream.fold (Fold.drainMapM print) . rate
770−-- >>> tap = Stream.tapCount (const True) report
771−-- >>> go = Stream.fold Fold.drain $ tap $ Stream.enumerateFrom 0
772−--
773−-- Note: This may not work correctly on 32-bit machines because of Int
774−-- overflow.
775−--
776−-- /Pre-release/
777−--
778+-- Deprecate in a major release.
779+-- {-# DEPRECATED tapCount "Please use parTapCount instead." #-}
780+-- | Same as 'parTapCount'. Deprecated.
778781{-# INLINE tapCount #-}
779782tapCount ::
780783 (MonadAsync m)
@@ -782,4 +785,4 @@ tapCount ::
782785 -> (Stream m Int -> m b)
783786 -> Stream m a
784787 -> Stream m a
785−tapCount = tapCountD
788+tapCount = parTapCount