on master help sign in
update some notes/doc on exception handling
b604937Harendra Kumar
src/Streamly/Streams/StreamD.hs+5−7
@@ -1704,10 +1704,10 @@ after action (Stream step state) = Stream step' state
1704 Stop -> action >> return Stop
1704 Stop -> action >> return Stop
1705
1705
1706-- XXX These combinators are expensive due to the call to
1706-- XXX These combinators are expensive due to the call to
1707−-- onException/handle/try on each step. Therefore, they should called in an
1707+-- onException/handle/try on each step. Therefore, when possible, they should
1708−-- outer loop where we perform less iterations. For example, we cannot call
1708+-- be called in an outer loop where we perform less iterations. For example, we
1709−-- them on each iteration in a char stream, instead we can call them when doing
1709+-- cannot call them on each iteration in a char stream, instead we can call
1710−-- an IO on an array.
1710+-- them when doing an IO on an array.
1711--
1711--
1712-- XXX For high performance error checks in busy streams we may need another
1712-- XXX For high performance error checks in busy streams we may need another
1713-- Error constructor in step.
1713-- Error constructor in step.
@@ -1726,10 +1726,8 @@ onException action (Stream step state) = Stream step' state
1726 case res of
1726 case res of
1727 Yield x s -> return $ Yield x s
1727 Yield x s -> return $ Yield x s
1728 Skip s -> return $ Skip s
1728 Skip s -> return $ Skip s
1729− Stop -> action >> return Stop
1729+ Stop -> return Stop
1730
1730
1731−-- XXX check if a monolithic implementation would be more performant.
1732−--
1733-- | Run a side effect whenever the stream stops normally or aborts due to an
1731-- | Run a side effect whenever the stream stops normally or aborts due to an
1734-- exception.
1732-- exception.
1735{-# INLINE finally #-}
1733{-# INLINE finally #-}