@@ -274,6 +274,7 @@ _splitOn byte (D.Stream step state) = D.Stream step' (Initial state)
274 case r of
274 case r of
275 D.Yield arr s -> do
275 D.Yield arr s -> do
276 (arr1, marr2) <- A.breakOn byte arr
276 (arr1, marr2) <- A.breakOn byte arr
277+ -- XXX Should use MutArray.splice
277 buf' <- A.splice buf arr1
278 buf' <- A.splice buf arr1
278 return $ case marr2 of
279 return $ case marr2 of
279 Nothing -> D.Skip (Buffering s buf')
280 Nothing -> D.Skip (Buffering s buf')
@@ -304,7 +305,11 @@ splitOn
305 -> Stream m (Array Word8)
306 -> Stream m (Array Word8)
306 -> Stream m (Array Word8)
307 -> Stream m (Array Word8)
310+ -- XXX use spliceExp and rightSize?
307−splitOn byte = D.splitInnerBy (A.breakOn byte) A.splice
311+ . D.splitInnerBy (MA.breakOn byte) MA.splice
309{-# INLINE splitOnSuffix #-}
314{-# INLINE splitOnSuffix #-}
310splitOnSuffix
315splitOnSuffix
@@ -313,7 +318,12 @@ splitOnSuffix
313 -> Stream m (Array Word8)
318 -> Stream m (Array Word8)
314 -> Stream m (Array Word8)
319 -> Stream m (Array Word8)
315-- splitOn byte s = fromStreamD $ A.splitOn byte $ toStreamD s
320-- splitOn byte s = fromStreamD $ A.splitOn byte $ toStreamD s
323+ -- XXX use spliceExp and rightSize?
316−splitOnSuffix byte = D.splitInnerBySuffix (A.breakOn byte) A.splice
324+ . D.splitInnerBySuffix
325+ (\arr -> MA.byteLength arr == 0) (MA.breakOn byte) MA.splice
318-------------------------------------------------------------------------------
328-------------------------------------------------------------------------------
319-- Elimination - Running folds
329-- Elimination - Running folds