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
6 changes: 4 additions & 2 deletions benchmark/Streamly/Benchmark/Data/Array/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ fold s = void $ Array.foldBreak Fold.drain $ StreamK.fromStream s
{-# INLINE parse #-}
parse :: Int -> Stream IO (Array.Array Int) -> IO ()
parse value s =
void $ Array.parseBreakChunksK (drainWhile (< value)) $ StreamK.fromStream s
void $ Array.parseBreak
(Array.parserK (drainWhile (< value)))
(StreamK.fromStream s)

{-# INLINE foldBreak #-}
foldBreak :: StreamK IO (Array.Array Int) -> IO ()
Expand All @@ -250,7 +252,7 @@ foldBreak s = do
{-# INLINE parseBreak #-}
parseBreak :: StreamK IO (Array.Array Int) -> IO ()
parseBreak s = do
r <- Array.parseBreakChunksK Parser.one s
r <- Array.parseBreak (Array.parserK Parser.one) s
case r of
(Left _, _) -> return ()
(Right _, s1) -> parseBreak s1
Expand Down
6 changes: 3 additions & 3 deletions benchmark/Streamly/Benchmark/Data/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@ takeWhileFail predicate (Fold fstep finitial _ ffinal) =
fres <- fstep s a
return
$ case fres of
Fold.Partial s1 -> Partial 0 s1
Fold.Done b -> Done 0 b
Fold.Partial s1 -> SPartial 1 s1
Fold.Done b -> SDone 1 b
else return $ Error "fail"

extract s = fmap (Done 0) (ffinal s)
extract s = fmap (SDone 0) (ffinal s)

{-# INLINE alt2 #-}
alt2 :: Monad m
Expand Down
6 changes: 3 additions & 3 deletions benchmark/Streamly/Benchmark/Data/ParserK.hs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ takeWhileFailD predicate (Fold fstep finitial _ ffinal) =
fres <- fstep s a
return
$ case fres of
Fold.Partial s1 -> Partial 0 s1
Fold.Done b -> Done 0 b
Fold.Partial s1 -> SContinue 1 s1
Fold.Done b -> SDone 1 b
else return $ Error "fail"

extract s = fmap (Done 0) (ffinal s)
extract s = fmap (SDone 0) (ffinal s)

{-# INLINE takeWhileFail #-}
takeWhileFail :: CONSTRAINT =>
Expand Down
5 changes: 3 additions & 2 deletions benchmark/streamly-benchmarks.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ common bench-depends
, tasty-bench >= 0.3 && < 0.5
, tasty >= 1.4.1 && < 1.6
, streamly-core
, bench-test-lib

if !flag(use-streamly-core)
build-depends: streamly
build-depends:
streamly
, bench-test-lib

if flag(fusion-plugin) && !impl(ghcjs) && !impl(ghc < 8.6)
build-depends:
Expand Down
15 changes: 15 additions & 0 deletions core/docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@

### Breaking Changes

* In the `Streamly.Data.Parser` module, constructors `Partial`,
`Continue`, `Done` have been deprecated and replaced by `SPartial`,
`SContinue` and `SDone`. Old code can be changed to use new
constructors as follows:

* In the step function of a parser, constructor `Partial n` should
be replaced by `SPartial (1-n)`, `Continue n` by `SContinue (1-n)`
and `Done n` by `SDone (1-n)`. A pattern match `SPartial n` can be
replaced by `SPartial m -> let n = 1 - m; ... ` and so on.
* In the extract function `Contine n` should be replaced by `Continue (-n)`
and `Done n` by `Done (-n)`.

If the `n` returned by these constructors is used in making some decisions,
that will have to be modified accordingly. See the docs for more details.

### Enhancements

* Add several concurrent combinators for folds in `Streamly.Data.Fold.Prelude`.
Expand Down
Loading
Loading