Commit Graph

374 Commits

Author SHA1 Message Date
pranaysashank
51127df924 Add test for MonadFail instance of Parser. 2020-07-10 19:57:57 +05:30
Harendra Kumar
095513166d Enable TypeFamilies extension with NoMonoLocalBinds
MonoLocalBinds enabled by TypeFamilies causes performance regressions
see #567, however we can enable TypeFamilies without it.
2020-07-09 18:40:34 +05:30
pranaysashank
745265e0f5 Use default-extensions for tests. 2020-07-07 15:18:21 +05:30
pranaysashank
202f674462 Change the signature of foldlM' to use a monadic seed.
- Also change usages of foldlM' in tests and benchmarks.
2020-07-07 14:17:44 +05:30
Shlok Datye
9225c35d6b Add tests for unfold and unfold0 2020-07-03 15:57:33 +05:30
Harendra Kumar
55d49bd50c Optimize Functor/Applicative/Monad etc for serial
Some of the benchmarks were order of magnitude off due to missing INLINE for
type class operations. Now, all of them are in reasonable limits. Benchmarks
affected for serial streams:

* Functor, Applicative, Monad, transformers

We need to do a similar exercise for other types of streams and for
folds/parsers as well.
2020-06-23 13:41:41 +05:30
Shruti_Umat
7eab2aff7c nested-if indentation fix 2020-06-11 18:21:30 +05:30
Shruti_Umat
03ee5ef784 remove prefix test from test function names
fix indentation

change repo token for travis build

fix do block indentation
2020-06-11 18:21:30 +05:30
Shruti_Umat
374668fb34 Add tests for partial folds and few full folds
test for maximumBy, maximum

test for head, sum, prod, max, min

toList, length tests

toList, length tests

tests for partial folds and few full folds

Fix indentation, remove warnings
2020-06-11 18:21:30 +05:30
Ahmed Zaheer Dadarkar
88c2aed1cd Split test into smaller property tests.
- Use `listEquals` for lists.
- Update description of tests.
2020-06-11 09:15:19 +05:30
Ahmed Zaheer Dadarkar
c1077de099 add test for many, comment failing test for some 2020-06-11 09:14:27 +05:30
Ahmed Zaheer Dadarkar
9751698ff7 Add tests for shortest and longest.
- Remove deintercalate test since it is unimplemented.
2020-06-11 09:13:49 +05:30
Ahmed Zaheer Dadarkar
b2cbde7ecf Add tests for ParserD. 2020-06-11 09:10:58 +05:30
Ahmed Zaheer Dadarkar
646cb86f0d update use of <> with ++ 2020-06-10 08:20:52 +05:30
Ahmed Zaheer Dadarkar
dda3fb8b91 comment lookAhead failing cases for now 2020-06-10 08:20:52 +05:30
Ahmed Zaheer Dadarkar
f67df51e6b update chooseInt with choose restricted to Int 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
103e5863c8 update description of tests 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
14f4dcdbe9 update to use different equality checker for lists 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
f819fdd313 add lookAheadFail function to test failure case of lookAhead 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
3fa6710e3d add description for test functions 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
f2a1219c6f split functions into pass case and either (pass or fail) case 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
75f1f8e098 add top level variables and split test functions with multiple properties 2020-06-10 08:18:59 +05:30
Ahmed Zaheer Dadarkar
2f8d9b0a31 Add tests for Internal.Data.Parser.
- Tests are added for the functions: yield, yieldM, die, dieM, any,
all, fromFold, peek, eof, satisfy, take, takeEQ, takeGE, takeWhile,
takeWhile1, lookAhead, sliceSepBy.
2020-06-10 08:17:15 +05:30
Harendra Kumar
2c0f829e35 Use streamly clock instead of "clock" pkg 2020-06-03 23:30:04 +05:30
Harendra Kumar
1691aa3ed1 Move rate test to examples 2020-06-03 23:30:04 +05:30
Pranay Sashank
30ddc28884 Fix -dev compilation failure. 2020-04-23 02:03:32 +05:30
Pranay Sashank
828a564781 Add GHC 8.10.1 build to CI.
- Disable inspection testing for `fromStreamVar`.
- Fix overlapping pattern matches warning in test/Main.hs.
2020-04-22 14:32:30 +05:30
Harendra Kumar
0e2bb73d6c Add a test for "fromCallback" 2020-02-26 16:27:05 +05:30
adithyaov
9fd164b012 Modify boundary condition tests for lastN 2020-02-26 13:41:45 +05:30
adithyaov
59509cd378 Fix lastN for n <= 0 2020-02-26 13:41:45 +05:30
adithyaov
99a9b612ec Add test checking for conflicting versions when build depends on ghc 2020-02-10 13:00:33 +05:30
adithyaov
9bab836f6c Change module structure for PrimArray
Data.PrimArray -> Data.Prim.Array
2020-01-25 15:39:59 +05:30
adithyaov
4008a26ee2 Add a test-suite for PrimArray 2020-01-25 15:39:56 +05:30
Pranay Sashank
00f541e6d5 Hide Streamly.Data.Array and Streamly.Data.SmallArray.
- Closes #378
2020-01-21 13:24:22 +05:30
Harendra Kumar
290d2f6135 Make some updates to takeByTime/dropByTime
* Document the precise behavior, some changes were made to the earlier behavior
* Make some changes to implementation according to (newly) documented behavior
* TakeByTime: perform the time check before generating the element so that we
  do not drop an element after generation.
* TakeByTime now yields at least one element if the duration is non-zero
* dropByTime does not check the time after the drop duration is over
* Add inspection tests
* make the tests for shorter duration, earlier tests took too long
2020-01-16 02:02:37 +05:30
adithyaov
1979370373 Add takeByTime and dropByTime combinators 2020-01-16 02:02:37 +05:30
adithyaov
5aa8e44d24 Add tests to lastN 2020-01-02 16:51:43 +05:30
adithyaov
d6afd92d98 Add rollingHashFirstN, drainN and drainWhile 2019-12-30 15:57:34 +05:30
Pranay Sashank
41f13253e5 Add test for tap. 2019-12-17 13:39:04 +05:30
Pranay Sashank
333dc6630f Merge Memory, Data, SmallArray tests into one module. 2019-12-12 14:03:43 +05:30
Pranay Sashank
ee32239753 Add tests for Streamly.Data.SmallArray. 2019-12-12 14:03:43 +05:30
Pranay Sashank
ae2dce8db1 Add write and fromStream Data.Array apis and corresponding tests.
- Remove length field from Data.Array.
2019-12-04 13:41:55 +05:30
Pranay Sashank
175b0b6d10 Add tests for Streamly.Data.Array and read operator. 2019-12-04 13:41:55 +05:30
Pranay Sashank
a97e3f39fb Fix bug in findIndices and add a regression test. Fixes #311.
- Update Changelog.
2019-11-21 02:29:27 +05:30
Harendra Kumar
75b0bacc3e Hold the foldWith etc. move to Prelude 2019-11-15 03:07:05 +05:30
Harendra Kumar
011299be70 rename Unicode encode/decode ops
* refactor the Unicode stream module in Stream/Char/Array modules
2019-11-04 02:54:46 +05:30
Harendra Kumar
44e3cb36e9 hide char array string ops from Unicode stream module 2019-11-04 02:35:55 +05:30
Harendra Kumar
ab6587ba59 Move Data/String to Internal/Data/Unicode/Stream
rename Data.String to Data.Unicode.Stream
2019-11-04 02:35:55 +05:30
Harendra Kumar
58d1d61afd Use unfolds instead of streams for array reading 2019-10-15 00:40:15 +05:30
Harendra Kumar
16c2f015c2 rename "runFold" to "fold"
* we are using "unfold" for unfolding, runUnfold is longer and sounds a bit
  weird. So similar to "unfold" we should use "fold" for folding.
* Another reason is that "runFold" sound ends in "unfold" so can sound
  confusing.
2019-09-29 14:52:29 +05:30
Harendra Kumar
b8b3e17eef stop exporting ArrayStream APIs from Array module
This module is now only for convenience as all APIs can be expressed in terms
of Stream APIs with the same performance.
2019-09-26 01:36:19 +05:30
Harendra Kumar
e62d37ed18 remove export of readU from Streamly.Internal 2019-09-25 17:17:46 +05:30
Harendra Kumar
a754b13030 rename Streamly.List to Streamly.Internal.Data.List 2019-09-25 17:17:46 +05:30
Harendra Kumar
042b677592 Move Streamly.Fold module
* Move exposed Streamly.Fold to Streamly.Data.Fold
* Move the internal implementation to Streamly.Inetrnal.Data.Fold
2019-09-24 21:14:51 +05:30
Harendra Kumar
b051167f42 Use Internal.Prelude module in place of Internal 2019-09-24 20:55:07 +05:30
Harendra Kumar
9e46ec65fc Add some tests and benchmarks for decode-utf8 2019-09-19 08:59:59 +05:30
Harendra Kumar
0b2f615930 Add splitInnerBySuffix to split lines in inner container 2019-09-15 23:24:39 +05:30
Harendra Kumar
1c339acfc6 Hide some array stream combinators
* Those that can already be expressed in terms of streams
* Those that are not used anywhere, if needed they can be expressed in terms of
* streams.
2019-09-13 14:02:58 +05:30
Harendra Kumar
6f06bdd7fe move the concatMap inspection test to benchmarks 2019-08-27 21:29:57 +05:30
Harendra Kumar
9c419e62f2 implement arraysOf in terms of chunksOf
* Reimplement groupsOf for better fusion
* Use A.writeNUnsafe for better fusion with groupsOf

Now we can use chunksOf/groupsOf to implement arraysOf with equivalent
performance. This commit hides the arraysOf from the Array module and export it
via Streamly.Internal because in one case (writeS) it still is faster. This can
be resolved once GHC issue is resolved. Even though writeS is not an officially
exported API, this case indicates that there may potentially be more such cases
which do not fuse well, so we are keeping this as a backup for such cases for
now.
2019-08-20 09:00:49 +05:30
Harendra Kumar
9bf7415f0b rename flatten to concat
concat is the conventional naming for flattening, and we do not need this name
for something else (e.g. flattening array of arrays). So we can reuse this for
consistency.
2019-08-17 05:15:42 +05:30
Harendra Kumar
1bfca9e46c merge the ArrayStream module to Array module itself
Each container type (e.g. Handle/Socket/File) may have similar nested/stream
level operations. We need a standardized way of naming the combinators related
to streams of containers.  Also, we cannot have a separate module for such
combinators for each container type. Therefore it makes sense to put them in
the same module.
2019-08-17 05:13:48 +05:30
Pranay Sashank
d26ab21364 Move Streamly.String to Streamly.Data.String. 2019-08-13 13:09:22 +05:30
Harendra Kumar
06b0cb1328 Implement IO write operations as folds. 2019-08-12 07:13:26 +05:30
Harendra Kumar
1e6b3b6261 Expose hidden Prelude APIs via Streamly.Internal module 2019-08-07 03:44:02 +05:30
Pranay Sashank
bda6a6415b Refactor modules Mem.* ~> Memory.* and update references. 2019-08-06 04:31:23 +05:30
Harendra Kumar
2438be4259 rename the Mem.Array.Stream module to Mem.ArrayStream 2019-08-06 02:55:06 +05:30
Harendra Kumar
a740d4dba9 move stream transformation operations to Prelude 2019-08-03 23:15:26 +05:30
Harendra Kumar
3cdecba40c Create a separate module for "Streams of Arrays" 2019-08-03 08:16:23 +05:30
Harendra Kumar
fdec798a63 update doc, hide some combinators, rename split combinators 2019-08-03 05:16:59 +05:30
Artyom Kazak
e7a7801cd9 Add an inspection test for #214 2019-07-26 18:32:24 +03:00
Harendra Kumar
ed7f4ab1a6 Implement bounded buffering for ParallelT streams
* Earlier ParallelT was unaffected by `maxBuffer` directive, now `maxBuffer`
  can limit the buffer of a ParallelT stream as well. When the buffer becomes
  full the producer threads block.
* ParallelT streams no longer have an unlimited buffer by default. Now the
  buffer for parallel streams is limited to 1500 by default, the same as other
  concurrent stream types.
2019-06-27 15:48:56 +05:30
Harendra Kumar
dbaacea1c6 implement fromStreamDArraysOf more efficiently
The implementation of fromStreamDArraysOf is now 3x more efficient compared to
the earlier implementation. This makes byte stream level operations almost as
efficient as array level operations.

Other than this the following changes are added in this commit:
* Add insertAfterEach
* Add writeArraysPackedUpto to Handle IO
* Implement `wc -l` example more efficiently using arrays
* Add benchmark for lines/unlines using arrays
* Add tests for splitArraysOn
* Rename some array/file/handle APIs
* Error handling when the group size in grouping operations is 0 or negative
2019-06-15 19:01:09 +05:30
Pranay Sashank
254f27fde8 Add unlines, unwords, tests for lines/unlines and words/unwords. 2019-06-12 10:30:15 +05:30
Pranay Sashank
7b216d8a67 Add a test for encodeUtf8 and decodeUtf8. 2019-06-12 10:30:15 +05:30
Pranay Sashank
64524bf4f6 Make fromIndicesM concurrent, and add tests for fromIndicesM. 2019-06-01 21:49:08 +05:30
Pranay Sashank
e6699ece2f Fix a bug in uniq function. Fixes #191. 2019-06-01 21:49:08 +05:30
Pranay Sashank
6ed211f28a Changes the signature of iterateM. Fixes #190.
Now, iterateM is
(IsStream t, MonadAsync m) => (a -> m a) -> m a -> t m a
2019-06-01 21:49:08 +05:30
Harendra Kumar
8bcbc77e62 rename Streamly.Array to Streamly.Mem.Array 2019-05-15 20:41:45 +05:30
Harendra Kumar
38c5c8872c Add File IO support 2019-05-15 17:54:12 +05:30
Harendra Kumar
7336d585a9 Fix a bug caused by unsafeInlineIO
unsafe use of unsafeInlineIO caused each array allocated in the toArrayN fold
to share the same memory.

This fix uses the IO monad to make sure that the code is not pure and therefore
we always allocate new memory. All such usage of unsafePerformIo have been
fixed. The remaining ones are reviewed to be safe.
2019-05-13 12:21:16 +05:30
Harendra Kumar
5240fe541f add array test cases 2019-05-13 12:21:16 +05:30
Harendra Kumar
fd7bd713ec Add "Streamly.Fold" module 2019-05-13 12:21:16 +05:30
Harendra Kumar
36c4c4ca7b Add Streamly.Array module
* Supports fixed size immutable arrays
* See the module documentations for details.
2019-05-13 12:21:16 +05:30
Harendra Kumar
db2c560a65 add direct versions of monolithic scan/map and fold/map
After perf measurement these seems to perform the same as a scan followed by
map therefore we have not exposed these but kept for perf comparison and just
in case use.

* Deprecate `scanx`, `foldx`, `foldxM`
* Remove deprecated APIs `scan`, `foldl`, `foldlM`
2019-05-04 15:35:55 +05:30
Harendra Kumar
f1670f31ce Move some functions from Streamly to Streamly.Prelude
* `runStream`, `foldWith`, `foldMapWith`, `forEachWith` have been moved from
  "Streamly" module to "Streamly.Prelude" module.
2019-05-04 02:42:38 +05:30
Harendra Kumar
0ce4a6d5ad Fix right fold, document folds, add generic folds
* Fix the signature of foldrM
* Implement some custom folds in terms of foldr
* Document folds and scans better
* Reorganize the documentation in Prelude
* Add foldrS and foldrT for transforming folds
* add toRevList
* Add benchmarks and tests for the new folds
2019-05-03 16:46:43 +05:30
Harendra Kumar
c5e3a6dc9f Add tests for maxThreads and maxBuffers directives 2019-03-27 23:21:06 +05:30
Harendra Kumar
c86b6734f5 Add GHCJS support 2019-01-11 16:04:46 +05:30
Harendra Kumar
97035c5c0b Fix GHC-8.6 build
Fix build for ghc-8.0.2

fix sdl install in CI
2018-12-31 02:52:24 +05:30
Harendra Kumar
d08c057f8f Add Enumerable type class 2018-12-29 16:22:29 +05:30
Harendra Kumar
dbc1956141 Review of #138 (Prelude functions) and other changes
APIs
----

Removed:
  merge
  lazy left scans: scanl, scanlM, scanl1, scanl1M

Renamed:
  generate and generateM renamed to fromIndices and fromIndicesM

Added:
  replicate
  mergeByM, mergeAsyncBy, mergeAsyncByM
  `intFrom`, `intFromTo`, `intFromThen`, `intFromThenTo`,
  `intFromStep`, `fracFrom`, `fracFromThen`, `fracFromThenTo`,
  `numFromStep`

Added StreamD version of replicateM and a rewrite rule for replicateMSerial.

Added but not exposed:
  postscanl and prescanl ops

Rewrote mergeByS in StreamK, simplified quite a bit and got some perf
improvement too.

Added @since notations to new APIs.

Fixed lines exceeding 80 columns.

Tests
-----

Added tests for the new enumeration APIs.
Improved some tests by generating values randomly using quickcheck forAll. We
can improve more tests similarly.

Removed some redundant transformOps tests.

reorganized test code in groups so as to keep similar functionality together
and added header lines so that we can find relevant code easily.

Benchmarks
----------

Added benchmarks for enumeration primitives added above. Added benchmarks for
scan and fold mixed ops. Added benchmark for concatMap. Fixed foldr and foldrM
benchmarks to use a (+) operation instead of a list operation for fair
comparision with other folds.

Kept only one benchmark each for deleteBy, insertBy, isPrefixOf and
isSubsequenceOf.

Documentation
-------------

Updated documentation, added examples for the new primitives as well as many
old ones. Especially the documentation of folds and scans was rewritten.

Reordered and re-organized the groups of APIs in the doc.

Refactoring
-----------

Some related and urelated refactoring.

Hlint
-----

Fixed some hlint hints introduced recently.

TBD
---

Some APIs need concurrent versions. I have added "XXX" notes for those.
Some more tests have to be added.
Some more benchmarks have to be added.
2018-12-09 19:39:37 +05:30
Pranay Sashank
04907e303e Remove splitAt. 2018-11-22 10:07:12 +05:30
Pranay Sashank
5bb0a49a9a Add concatMap, concatMapM, generateM, generate, findM to Prelude. 2018-11-22 10:03:46 +05:30
Pranay Sashank
b2c86b1094 Add replicate. 2018-11-22 10:03:00 +05:30
Pranay Sashank
dbcf5363e8 Add isPrefixOf, isSubsequenceOf, stripPrefix to Prelude, StreamD. 2018-11-22 10:03:00 +05:30
Pranay Sashank
acc38719fd Fixed insertBy to use correct state. Add deleteBy.
- Benchmarks show very poor performance of insertBy and
deleteBy compared to StreamK. Should be improved in StreamD.
2018-11-22 10:02:04 +05:30
Pranay Sashank
7f82af409c Add scanl1, scanl1M, scanl1', scanl1M', scanl, scanlM to StreamD. 2018-11-22 10:00:38 +05:30
Pranay Sashank
3186bd283f Add maximumBy and minimumBy. 2018-11-22 09:56:48 +05:30
Pranay Sashank
5cc6933cdb Add (!!), insertBy, merge, mergeBy, splitAt, the to Prelude.
1) Add foldr1, findIndices, lookup, find, sequence functions
in StreamD, earlier they were present only in StreamK.
2) Change the above functions to use S. in Prelude instead
of K. .
3) Add tests for (!!), insertBy, splitAt, the.
2018-11-22 09:53:40 +05:30
Harendra Kumar
11d8d6dc66 Fix foldable/traversable instances
1) Define the instances manually instead of deriving. Deriving picks up
incorrect implementations of methods that have been redefined in the newtypes.

2) Fix the Traversable instance.

3) Define the instances only for Serial stream types. Other streams cannot be
instantiated for Foldable monads.

4) Add test cases

5) add benchmarks
2018-11-19 12:13:33 +05:30
Harendra Kumar
0839d4f6f1 Add the ZipList type and more tests for pure lists 2018-11-19 08:55:20 +05:30
Harendra Kumar
ee0c73b22c Add List and String types 2018-11-16 14:39:26 +05:30
Harendra Kumar
c28043f48a Add pure stream (list) instances
Pure streams are streams with Identity as the base monad.
Added Eq/Ord/Read/Show/IsString/IsList instances for pure streams.
2018-11-16 14:39:26 +05:30
Harendra Kumar
e810658dfe Fix monadic state capture and restore for concurrent tasks
This causes up to 30% regression in async stream generation benchmarks and up
to 200% regression in async nested benchmarks. Mostly, due to an additional
functional call that cannot be inlined.
2018-10-22 13:37:39 +05:30
Harendra Kumar
bf81f70a4e lint free tests 2018-10-13 10:36:06 +05:30
Harendra Kumar
38aa5f2d0c Refactor code, add asserts, better test output 2018-10-13 04:05:01 +05:30
Harendra Kumar
83dc30a7fe disable some intermittently failing tests
These are parallel/concurrent tests that fail due to unpredictable delays in
scheduling.
2018-09-12 12:39:18 +05:30
Harendra Kumar
cca869f7ed Fix a rate control issue
We were not sending enough workers in the end when the streaming is finishing.
Also, limit the estimated workers to the number of yields required.
2018-09-12 11:13:56 +05:30
Harendra Kumar
ebdfa837f2 implement rateBuffer to forget distant gains/losses 2018-08-25 06:33:08 +05:30
Harendra Kumar
482b971ebb make custom rate combinators functions
instead of constructors
2018-08-25 04:51:00 +05:30
Harendra Kumar
aa8345d0d4 Add avg/min/max/const/rate specifications for rate 2018-08-23 06:58:03 +05:30
Harendra Kumar
a74f668de7 rename yieldRate to just rate 2018-08-19 06:24:37 +05:30
Harendra Kumar
904de167ff refactor some of the yieldRate stuff 2018-08-19 05:04:22 +05:30
Harendra Kumar
6ae6879887 rename maxRate to yieldRate, update doc 2018-08-18 01:51:52 +05:30
Harendra Kumar
c9aecb3486 Fix some issues in yield limit handling for aheadly 2018-08-16 04:40:49 +05:30
Harendra Kumar
05ca066661 Add GC based cleanup of SVars 2018-08-15 05:56:35 +05:30
Harendra Kumar
2c0a6fbd31 cancel parallel tasks when take completes 2018-08-14 23:19:29 +05:30
Harendra Kumar
e1b6740a7c reduce ci tests 2018-08-12 18:20:03 +05:30
Harendra Kumar
7f05a78f1b use stack builds, make coverage build faster 2018-08-12 18:20:03 +05:30
Harendra Kumar
c602d84990 Fix "not sufficient concurrency" in ahead streams 2018-08-12 18:20:03 +05:30
Harendra Kumar
b33e9c274b performance improvements after maxrate changes 2018-08-12 18:20:03 +05:30
Harendra Kumar
610c33a504 Add concurrency rate control using maxRate 2018-08-12 18:20:03 +05:30
Harendra Kumar
c39a442ddf Add benchmarks and tests for new operations
Also fix the signature of foldl1'
Add notes about state passing
2018-08-09 00:43:48 +05:30
Harendra Kumar
cd50805c92 Do not share concurrency state in concurrent function application 2018-08-08 17:17:56 +05:30
Veladus
8fec7c27ae Generalized eliminateOp and transform; add test for Prelude#lookup 2018-07-24 18:45:52 +02:00
Veladus
a9aa3aeef8 Add Prelude#foldl1', Prelude#foldr1 2018-07-24 18:45:52 +02:00
Veladus
9706067159 Add Prelude#intersperseM 2018-07-24 18:45:35 +02:00
Veladus
74ce247d71 Add Prelude#find, Prelude#lookup 2018-07-24 18:28:30 +02:00
Veladus
52eccb97e7 Add Prelude#findIndices, Prelude#findIndex, Prelude#elemIndices, Prelude#elemIndex 2018-07-24 18:27:11 +02:00
Veladus
e6c75f6aa9 Add Prelude#init 2018-07-24 18:23:56 +02:00
Harendra Kumar
55f9cfa371 fix foldxM strictness
The main change is a single line change in StreamK.hs in foldxM routine.

Major changes in this commit are due to:
1) Added strictness tests for all foldl and scanl rotuines
2) refactoring to enable independent benchmarking for StreamK, to measure the
  impact of the change.
2018-07-13 19:00:38 +05:30
Harendra Kumar
cf87d1132e implement maxYields to put a limit on total yields of a stream
maxYields is used to limit the concurrent executions of a stream when
it it is immediately followed by a "take" limiting the size of the stream.

Also fix the maxBuffer implementation of aheadly.
2018-07-02 08:46:57 +05:30
Harendra Kumar
a362b53762 reduce the number of prop tests to enable coverage
coverage builds take too long with default number of property tests
2018-07-02 00:49:28 +05:30
Harendra Kumar
72766cb82b rename threads to maxThreads and buffer to maxBuffer 2018-07-01 23:53:10 +05:30
Harendra Kumar
211df792a4 Add concurrency control using "threads" and "buffer"
Also exposed the "filterM" API.

Some benchmarks are affected with this. The most affected benchmarks are:

StreamK ops:
before:
serially/generation/foldMapWith          mean 1.940 ms
serially/generation/foldMapWithM         mean 3.891 ms

After:
serially/generation/foldMapWith          mean 2.874 ms
serially/generation/foldMapWithM         mean 5.003 ms

StreamD ops:
zip/zipM are affected
2018-07-01 02:43:48 +05:30
Harendra Kumar
9fe6dc1726 use direct style zipWith and zipWithM 2018-06-27 09:10:39 +05:30
Harendra Kumar
2b1093a8dc use workaround for stack/ghc-8.2.2 crash 2018-06-25 06:58:47 +05:30
Harendra Kumar
0b6d7a22d7 increase the delay in concurrent ordering tests 2018-06-23 17:31:58 +05:30
Harendra Kumar
b856396e14 rename some qualified imports 2018-06-23 07:41:21 +05:30
Harendra Kumar
9c85811905 rename "once" to "yieldM"
and some other related refactoring changes.
2018-06-23 06:50:59 +05:30
Harendra Kumar
09fcf275d7 remove incorrect test for WAsync
Add a test for Parallel
2018-06-22 04:00:28 +05:30
Harendra Kumar
b9d8f28edd Fix memory barriers and worker dispatches 2018-06-14 17:02:28 +05:30
Harendra Kumar
c28f3f1c47 Fix a concurrency bug in filtering ops
The bug causes the ops take, takeWhile, drop, dropWhile, filter and reverse to
behave incorrectly due to illegal sharing of SVar across ops.
2018-06-05 19:27:39 +05:30
Harendra Kumar
4c00da9ab4
Merge pull request #76 from subbyte/master
mapMaybe and mapMaybeM Implemented
2018-05-30 05:24:58 +05:30
Xiaokui Shu
e46d341819 add mapMaybe and mapMaybeM 2018-05-29 13:12:27 -04:00
Harendra Kumar
c77d3fbd62 More consistent naming of operators 2018-05-28 13:24:42 +05:30
Harendra Kumar
e60357957c Add concurrent function application operators 2018-05-26 17:02:36 +05:30
Harendra Kumar
dfecce27eb Fix build for ghc-7.10 and 8.0 2018-05-24 17:35:18 +05:30
Harendra Kumar
9cb2ac0bb7 Add concurrent generation and transformation capabilities
- monadic stream generation functions are now concurrent
- monadic stream transformation (mapM, sequence) functions are now concurrent
- fixed a race which caused blockedindefinitely on MVar in rare cases
2018-05-24 16:48:48 +05:30