Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/Streamly/Benchmark/Data/Array/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ drainWhile p = Parser.takeWhile p Fold.drain

{-# INLINE fold #-}
fold :: Stream IO (Array.Array Int) -> IO ()
fold s = void $ Array.foldBreakChunksK Fold.drain $ StreamK.fromStream s
fold s = void $ Array.foldBreak Fold.drain $ StreamK.fromStream s

{-# INLINE parse #-}
parse :: Int -> Stream IO (Array.Array Int) -> IO ()
Expand All @@ -244,7 +244,7 @@ parse value s =
{-# INLINE foldBreak #-}
foldBreak :: StreamK IO (Array.Array Int) -> IO ()
foldBreak s = do
(r, s1) <- Array.foldBreakChunksK Fold.one s
(r, s1) <- Array.foldBreak Fold.one s
when (isJust r) $ foldBreak s1

{-# INLINE parseBreak #-}
Expand Down
9 changes: 6 additions & 3 deletions core/src/Streamly/Internal/Data/Array.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module Streamly.Internal.Data.Array
-- * Parsing Stream of Arrays
, foldBreakChunks -- Uses Stream, bad perf on break
, foldChunks
, foldBreakChunksK -- XXX rename to foldBreak
, foldBreak
, parseBreakChunksK -- XXX uses Parser. parseBreak is better?
, parserK
, parseBreak
Expand Down Expand Up @@ -105,6 +105,7 @@ module Streamly.Internal.Data.Array
, compactOnByteSuffix
, splitOn
, fold
, foldBreakChunksK
)
where

Expand Down Expand Up @@ -721,14 +722,14 @@ foldChunks f s = fmap fst (foldBreakChunks f s)
--
-- We can compare perf and remove this one or define it in terms of that.
--
foldBreakChunksK :: forall m a b. (MonadIO m, Unbox a) =>
foldBreak, foldBreakChunksK :: forall m a b. (MonadIO m, Unbox a) =>
Fold m a b -> StreamK m (Array a) -> m (b, StreamK m (Array a))
{-
foldBreakChunksK f s =
fmap (first (fromRight undefined))
$ StreamK.parseBreakChunks (ParserK.adaptC (Parser.fromFold f)) s
-}
foldBreakChunksK (Fold fstep initial _ final) stream = do
foldBreak (Fold fstep initial _ final) stream = do
res <- initial
case res of
Fold.Partial fs -> go fs stream
Expand Down Expand Up @@ -758,6 +759,8 @@ foldBreakChunksK (Fold fstep initial _ final) stream = do
return $! (b, StreamK.cons arr st)
Fold.Partial fs1 -> goArray fs1 st fp next

RENAME(foldBreakChunksK,foldBreak)

{-
-- This can be generalized to any type provided it can be unfolded to a stream
-- and it can be combined using a semigroup operation.
Expand Down
2 changes: 1 addition & 1 deletion core/src/Streamly/Internal/FileSystem/Windows/ReadDir.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ newtype DirStream =

openDirStream :: WindowsPath -> IO DirStream
openDirStream p = do
let path = Path.unsafeAppend p $ Path.unsafeFromString "*"
let path = Path.unsafeExtend p $ Path.unsafeFromString "*"
fp_finddata <- mallocForeignPtrBytes (# const sizeof(WIN32_FIND_DATAW) )
withForeignPtr fp_finddata $ \dataPtr -> do
handle <-
Expand Down
Loading