@@ -2817,17 +2817,16 @@ concatUnfoldTree unf xs = undefined
2817-- Feedback loop
2817-- Feedback loop
2818------------------------------------------------------------------------------
2818------------------------------------------------------------------------------
2820−-- Flatten a stream with a feedback loop back into the input. For example, if
2821−-- the output stream may generate an exception the exceptions can be fed back
2822−-- to the input to take any corrective action. For example, we may retry the
2823−-- action again or do nothing or log the errors. For the retry case we need a
2826-- We can perhaps even implement the SVar using this. The stream we are mapping
2820-- We can perhaps even implement the SVar using this. The stream we are mapping
2827-- on is the work queue. When evaluated it results in either a leaf element to
2821-- on is the work queue. When evaluated it results in either a leaf element to
2828-- yield or a tail stream to queue back to the work queue.
2822-- yield or a tail stream to queue back to the work queue.
2830−-- | Feedback a component of the output back to the input stream.
2824+-- | Flatten a stream with a feedback loop back into the input.
2826+-- For example, exceptions generated by the output stream can be fed back to
2827+-- the input to take any corrective action. The corrective action may be to
2828+-- retry the action or do nothing or log the errors. For the retry case we need
2832-- /Internal/
2831-- /Internal/
@@ -2836,7 +2835,7 @@ concatMapLoopWith
2836 :: (IsStream t, MonadAsync m)
2835 :: (IsStream t, MonadAsync m)
2837 => (forall x. t m x -> t m x -> t m x)
2836 => (forall x. t m x -> t m x -> t m x)
2838 -> (a -> t m (Either b c))
2837 -> (a -> t m (Either b c))
2839− -> (b -> t m a) -- feedback function to feed b back into input
2838+ -> (b -> t m a) -- ^ feedback function to feed @b@ back into input
2840 -> t m a
2839 -> t m a
2841 -> t m c
2840 -> t m c
2842concatMapLoopWith combine f fb xs =
2841concatMapLoopWith combine f fb xs =
@@ -2845,7 +2844,17 @@ concatMapLoopWith combine f fb xs =
2845 go (Left b) = concatMapLoopWith combine f fb $ fb b
2844 go (Left b) = concatMapLoopWith combine f fb $ fb b
2846 go (Right c) = yield c
2845 go (Right c) = yield c
2848−-- Concat a stream of trees, generating only leaves.
2847+-- | Concat a stream of trees, generating only leaves.
2849+-- Compare with 'concatMapTreeWith'. While the latter returns all nodes in the
2850+-- tree, this one returns only the leaves.
2852+-- Traversing a directory tree recursively and yielding on the files is a
2853+-- canonical use case of 'concatMapTreeYieldLeavesWith'.
2856+-- concatMapTreeYieldLeavesWith combine f = concatMapLoopWith combine f yield
2850-- /Internal/
2859-- /Internal/