on master help sign in
Fix since annotations of exception routines
02f7ce0Harendra Kumar
src/Streamly/Internal/Data/Stream/IsStream.hs+25−24
@@ -4829,24 +4829,25 @@ classifySessionsOf interval =
4829before :: (IsStream t, Monad m) => m b -> t m a -> t m a
4829before :: (IsStream t, Monad m) => m b -> t m a -> t m a
4830before action xs = D.fromStreamD $ D.before action $ D.toStreamD xs
4830before action xs = D.fromStreamD $ D.before action $ D.toStreamD xs
4831
4831
4832−-- | Run a side effect whenever the stream stops normally.
4832+-- | Run a side effect at the end of the stream. The side effect won't run if
4833+-- the stream is garbage collected before it reached the end.
4833--
4834--
4834−-- Prefer 'after' over this as the @after@ action in this combinator is not
4835+-- This has slightly better performance than 'after'.
4835−-- executed if the stream is partially evaluated lazily and then garbage
4836+--
4836−-- collected.
4837+-- /Internal/
4837--
4838--
4838−-- @since 0.7.0
4839{-# INLINE after_ #-}
4839{-# INLINE after_ #-}
4840after_ :: (IsStream t, Monad m) => m b -> t m a -> t m a
4840after_ :: (IsStream t, Monad m) => m b -> t m a -> t m a
4841after_ action xs = D.fromStreamD $ D.after_ action $ D.toStreamD xs
4841after_ action xs = D.fromStreamD $ D.after_ action $ D.toStreamD xs
4842
4842
4843−-- | Run a side effect whenever the stream stops normally
4843+-- | Run a side effect at the end of the stream or if it is garbage collected
4844−-- or is garbage collected after a partial lazy evaluation.
4844+-- even before reaching the end.
4845--
4845--
4846−-- /Internal/
4846+-- @since 0.7.0
4847--
4847--
4848{-# INLINE after #-}
4848{-# INLINE after #-}
4849−after :: (IsStream t, MonadIO m, MonadBaseControl IO m) => m b -> t m a -> t m a
4849+after :: (IsStream t, MonadIO m, MonadBaseControl IO m)
4850+ => m b -> t m a -> t m a
4850after action xs = D.fromStreamD $ D.after action $ D.toStreamD xs
4851after action xs = D.fromStreamD $ D.after action $ D.toStreamD xs
4851
4852
4852-- | Run a side effect whenever the stream aborts due to an exception.
4853-- | Run a side effect whenever the stream aborts due to an exception.
@@ -4856,22 +4857,22 @@ after action xs = D.fromStreamD $ D.after action $ D.toStreamD xs
4856onException :: (IsStream t, MonadCatch m) => m b -> t m a -> t m a
4857onException :: (IsStream t, MonadCatch m) => m b -> t m a -> t m a
4857onException action xs = D.fromStreamD $ D.onException action $ D.toStreamD xs
4858onException action xs = D.fromStreamD $ D.onException action $ D.toStreamD xs
4858
4859
4859−-- | Run a side effect whenever the stream stops normally or aborts due to an
4860+-- | Run a side effect at the end of the stream or if it aborts due to an
4860−-- exception.
4861+-- exception before it could reach the end. The side effect is not run if the
4862+-- stream is garbage collected before reaching the end.
4861--
4863--
4862−-- Prefer 'finally' over this as the @after@ action in this combinator is not
4864+-- This has slightly better performance than 'finally'.
4863−-- executed if the unfold is partially evaluated lazily and then garbage
4865+--
4864−-- collected.
4866+-- /Internal/
4865--
4867--
4866−-- @since 0.7.0
4867{-# INLINE finally_ #-}
4868{-# INLINE finally_ #-}
4868finally_ :: (IsStream t, MonadCatch m) => m b -> t m a -> t m a
4869finally_ :: (IsStream t, MonadCatch m) => m b -> t m a -> t m a
4869finally_ action xs = D.fromStreamD $ D.finally_ action $ D.toStreamD xs
4870finally_ action xs = D.fromStreamD $ D.finally_ action $ D.toStreamD xs
4870
4871
4871−-- | Run a side effect whenever the stream stops normally, aborts due to an
4872+-- | Run a side effect at the end of the stream, or if it aborts due to an
4872−-- exception or if it is garbage collected after a partial lazy evaluation.
4873+-- exception or if it is garbage collected before it could reach the end.
4873--
4874--
4874−-- /Internal/
4875+-- @since 0.7.0
4875--
4876--
4876{-# INLINE finally #-}
4877{-# INLINE finally #-}
4877finally :: (IsStream t, MonadAsync m, MonadCatch m) => m b -> t m a -> t m a
4878finally :: (IsStream t, MonadAsync m, MonadCatch m) => m b -> t m a -> t m a
@@ -4880,13 +4881,13 @@ finally action xs = D.fromStreamD $ D.finally action $ D.toStreamD xs
4880-- | Run the first action before the stream starts and remember its output,
4881-- | Run the first action before the stream starts and remember its output,
4881-- generate a stream using the output, run the second action using the
4882-- generate a stream using the output, run the second action using the
4882-- remembered value as an argument whenever the stream ends normally or due to
4883-- remembered value as an argument whenever the stream ends normally or due to
4883−-- an exception.
4884+-- an exception. The second action won't run if the stream is garbage collected
4885+-- before it could reach the end.
4884--
4886--
4885−-- Prefer 'bracket' over this as the @after@ action in this combinator is not
4887+-- This has slightly better performance than 'bracket'.
4886−-- executed if the unfold is partially evaluated lazily and then garbage
4888+--
4887−-- collected.
4889+-- /Internal/
4888--
4890--
4889−-- @since 0.7.0
4890{-# INLINE bracket_ #-}
4891{-# INLINE bracket_ #-}
4891bracket_ :: (IsStream t, MonadCatch m)
4892bracket_ :: (IsStream t, MonadCatch m)
4892 => m b -> (b -> m c) -> (b -> t m a) -> t m a
4893 => m b -> (b -> m c) -> (b -> t m a) -> t m a
@@ -4898,7 +4899,7 @@ bracket_ bef aft bet = D.fromStreamD $
4898-- remembered value as an argument whenever the stream ends normally, due to
4899-- remembered value as an argument whenever the stream ends normally, due to
4899-- an exception or if it is garbage collected after a partial lazy evaluation.
4900-- an exception or if it is garbage collected after a partial lazy evaluation.
4900--
4901--
4901−-- /Internal/
4902+-- @since 0.7.0
4902--
4903--
4903{-# INLINE bracket #-}
4904{-# INLINE bracket #-}
4904bracket :: (IsStream t, MonadAsync m, MonadCatch m)
4905bracket :: (IsStream t, MonadAsync m, MonadCatch m)