on master help sign in
update some notes/doc on exception handling
commitb604937edb86a3d4235586f6974a6fa61b5bdbc9 authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 2 Jun 2019, 05:07 (7 years ago) parenta2fd0dc
1 file changed+5−7
src/Streamly/Streams/StreamD.hs+5−7
src/Streamly/Streams/StreamD.hs+5−7
@@ -1704,10 +1704,10 @@ after action (Stream step state) = Stream step' state
17041704 Stop -> action >> return Stop
17051705
17061706-- XXX These combinators are expensive due to the call to
1707−-- onException/handle/try on each step. Therefore, they should called in an
1708−-- outer loop where we perform less iterations. For example, we cannot call
1709−-- them on each iteration in a char stream, instead we can call them when doing
1710−-- an IO on an array.
1707+-- onException/handle/try on each step. Therefore, when possible, they should
1708+-- be called in an outer loop where we perform less iterations. For example, we
1709+-- cannot call them on each iteration in a char stream, instead we can call
1710+-- them when doing an IO on an array.
17111711--
17121712-- XXX For high performance error checks in busy streams we may need another
17131713-- Error constructor in step.
@@ -1726,10 +1726,8 @@ onException action (Stream step state) = Stream step' state
17261726 case res of
17271727 Yield x s -> return $ Yield x s
17281728 Skip s -> return $ Skip s
1729− Stop -> action >> return Stop
1729+ Stop -> return Stop
17301730
1731−-- XXX check if a monolithic implementation would be more performant.
1732−--
17331731-- | Run a side effect whenever the stream stops normally or aborts due to an
17341732-- exception.
17351733{-# INLINE finally #-}