on master help sign in
Fix empty array issue when ring is full
commit5fd099e79b002d1a64dc940459ffda5d3d875a31 authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateThu 21 Apr 2022, 14:28 (4 years ago) parent889be18
1 file changed+2−1
core/src/Streamly/Internal/Data/Ring/Foreign.hs+2−1
core/src/Streamly/Internal/Data/Ring/Foreign.hs+2−1
@@ -548,7 +548,8 @@ slidingWindowWith n (Fold step1 initial1 extract1) = Fold step initial extract
548548 | i < n = do
549549 rh1 <- liftIO $ unsafeInsert rb rh a
550550 liftIO $ touchForeignPtr (ringStart rb)
551− r <- step1 st ((a, Nothing), toArray unsafeFoldRingM rb rh1)
551+ let action = toArray unsafeFoldRingM rb (PTR_NEXT(rh, a))
552+ r <- step1 st ((a, Nothing), action)
552553 return $
553554 case r of
554555 Partial s -> Partial $ Tuple4' rb rh1 (i + 1) s