@@ -69,7 +69,7 @@ module Streamly.Internal.Data.Zipper
71import Control.Exception (assert, Exception(..))
71import Control.Exception (assert, Exception(..))
72−import Control.Monad.Catch (MonadCatch, try, SomeException)
72+import Control.Monad.Catch (MonadCatch, try)
73-- import GHC.Types (SPEC(..))
73-- import GHC.Types (SPEC(..))
74import Prelude hiding (splitAt)
74import Prelude hiding (splitAt)
@@ -90,8 +90,8 @@ import qualified Streamly.Internal.Data.Stream.StreamK as K
91-- @checkpoints@ is a stack of checkpoints. A new checkpoint is created by a
91-- @checkpoints@ is a stack of checkpoints. A new checkpoint is created by a
92-- @checkpoint@ operation. A checkpoint consists of a count that tracks how
92-- @checkpoint@ operation. A checkpoint consists of a count that tracks how
93−-- many elements we have yielded after the checkpoint was taken. We need this
93+-- many elements we have yielded after the checkpoint was created. We need
94−-- information to backtrack to the checkpoint. If we enter a nested
94+-- this information to backtrack to the checkpoint. If we enter a nested
95-- alternative we add another checkpoint in the stack. When we exit an
95-- alternative we add another checkpoint in the stack. When we exit an
96-- alternative we call a @release@ on the checkpoint. The @release@ removes the
96-- alternative we call a @release@ on the checkpoint. The @release@ removes the
97-- checkpoint from the stack and adds its element count to the previous
97-- checkpoint from the stack and adds its element count to the previous
@@ -140,6 +140,8 @@ checkpoint :: Zipper m a -> Zipper m a
140checkpoint (Zipper cps xs ys stream) = Zipper (0:cps) xs ys stream
140checkpoint (Zipper cps xs ys stream) = Zipper (0:cps) xs ys stream
142-- | Release the latest checkpoint, releases any values held by the checkpoint.
142-- | Release the latest checkpoint, releases any values held by the checkpoint.
143+-- Note that the values may still be held by other checkpoints in the stack of
144-- /Internal/
146-- /Internal/
@@ -211,7 +213,7 @@ parse pstep initial extract (Zipper [] ls rs stream) =
211 pst <- acc
213 pst <- acc
212 r <- try $ extract pst
214 r <- try $ extract pst
213 return $ case r of
215 return $ case r of
214− Left (e :: SomeException) ->
216+ Left (e :: PR.ParseError) ->
215 (nil, Left (displayException e))
217 (nil, Left (displayException e))
216 Right b -> (nil, Right b)
218 Right b -> (nil, Right b)
217 single x = do
219 single x = do
@@ -294,7 +296,7 @@ parse pstep initial extract (Zipper (cp:cps) ls rs stream) =
294 pst <- acc
296 pst <- acc
295 r <- try $ extract pst
297 r <- try $ extract pst
296 return $ case r of
298 return $ case r of
297− Left (e :: SomeException) ->
299+ Left (e :: PR.ParseError) ->
298 (nil, Left (displayException e))
300 (nil, Left (displayException e))
299 Right b -> (nil, Right b)
301 Right b -> (nil, Right b)
300 single x = do
302 single x = do