Commit Graph

491 Commits

Author SHA1 Message Date
Harendra Kumar
a6e8e23062 Make enumerateFromStepNum numerically stable 2021-03-24 03:59:24 +05:30
Harendra Kumar
a5e483b610 Refactor Unfold module
* Rearrange exports, export additional functions
* Update docs
* Disable applicative/monad/category/arrow instances
* Rename const to yieldM and add yield
* Remove "effect", it can be expressed by yieldM
* Change order of arguments for some functions
2021-03-24 01:40:30 +05:30
Ranjeet Kumar Ranjan
b73b5ffa3a Rename concatUnfold to unfoldMany #986 2021-03-22 19:05:17 +05:30
Ranjeet Kumar Ranjan
7759cc0082 Rename Unfold.concat to Unfold.many #985 2021-03-20 00:40:13 +05:30
Pranay Sashank
7650587baa Implement fold in terms of fold_.
- Add test for fold_.
2021-03-18 13:11:23 +05:30
Harendra Kumar
3b1a26cee5 Update Fold module docs and expose some APIs 2021-03-16 01:46:51 +05:30
Adithya Kumar
f261f02d15 Make the behaviour of splitMany similar to that of parseMany 2021-03-13 03:33:17 +05:30
Adithya Kumar
7950a0a967 Add a test case for Fold.many 2021-03-12 01:01:51 +05:30
Ranjeet Kumar Ranjan
87ebad51cb Rename Types.hs modules to Type.hs 2021-03-11 15:12:08 +05:30
Harendra Kumar
bb72e18365 Remove mkAccum* fold constructors 2021-03-10 19:29:12 +05:30
Ranjeet Kumar Ranjan
4da398aa00 Change argument order in parser combinators #969
Keep the collecting fold as the last argument for ease of composition.
Data flows from one fold to the next, so the next fold in the chain
should be the last argument.
2021-03-09 23:10:43 +05:30
Adithya Kumar
eda484641a Add tests for foldIterateM 2021-03-09 07:56:12 +05:30
Harendra Kumar
ad9308ea6b Rearrange tests in the same order as in Data.Fold 2021-03-08 22:50:53 +05:30
Harendra Kumar
d2e3430348 Rename some fold combinators
This commit has no functional change, only renaming and doc edits.
2021-03-07 23:04:41 +05:30
Ranjeet Kumar Ranjan
df38c4a8a4 Change splitWith to serialWith in folds and parsers 2021-03-05 11:46:59 +05:30
Ranjeet Kumar Ranjan
0414fe8ec6 Rename takeLE to take 2021-03-05 11:43:48 +05:30
Harendra Kumar
ca29fd279e Make it build for GHC-9.0 2021-03-04 18:25:45 +05:30
Harendra Kumar
c8b9fac92b Move parse functions to Source module
Plus:

* Fix returning buffer in the "parse" function
* Some more minor formatting/doc fixups.
2021-02-21 01:58:20 +05:30
Harendra Kumar
2a7e3ccdbc Rename the resumable Unfold type to Producer 2021-02-21 01:58:20 +05:30
Harendra Kumar
7c95ccaaad Use an explicit state to represent nested loops 2021-02-21 01:58:20 +05:30
Harendra Kumar
c93bad0134 Simplify the type of resumable Unfold 2021-02-21 01:58:20 +05:30
Harendra Kumar
22c83f40fd Add resumable unfolds for efficient nested parsing
Instead of using a closed loop we can stop an unfold and then resume it
later. This allows us to break the loop and restart it at some other
point. For example, we can parse a block from an input stream from a
file handle or a socket and then return the socket/handle plus nay
buffered data (due to backtracking) so that we can resume reading from
it later on after doing some processing.
2021-02-21 01:58:20 +05:30
Harendra Kumar
77d11d37bb Add Monad instance for Unfold 2021-02-20 08:54:28 +05:30
Harendra Kumar
3947fee691 Add Applicative instance for Unfold 2021-02-20 08:51:30 +05:30
Adithya Kumar
521d9cfa7e Add a termination test for wSerialMin 2021-02-18 13:45:40 +05:30
Harendra Kumar
f6522bdd17 Remove sliceSepByMax
It can be expressed as:

sliceSepByMax p n = sliceSepBy p . takeLE n
2021-02-11 00:32:42 +05:30
Harendra Kumar
2131682e9a Update bin/test.sh cli help, add it to test/README.md 2021-02-10 02:00:33 +05:30
Harendra Kumar
7de5d6d7ff Allow -Werror without inspection/fusion-plugin
We may want to use the -Werror build locally but fusion-plugin takes too
much time to build, so separate the two.
2021-02-09 02:12:48 +05:30
Anurag Hooda
e4e1d25647 make sliceBeginWith fail when first element fails predicate 2021-02-07 20:05:01 +05:30
Anurag Hooda
fb9f05e4fb Add sliceBeginWith, tests and benchmarks 2021-02-07 20:05:01 +05:30
Pranay Sashank
ed030cc134 Rename some modules.
- Streamly.Internal.Memory.ArrayStream =>
  Streamly.Internal.Data.Array.Stream.Foreign
- Streamly.Memory.Ring =>
  Streamly.Internal.Ring.Foreign
- Streamly.FileSystem.IOVec =>
  Streamly.Internal.FileSystem.IOVec
- Streamly.FileSystem.FDIO =>
  Streamly.Internal.FileSystem.FDIO
- Streamly.FileSystem.FD =>
  Streamly.Internal.FileSystem.FD

Closes #873.
2021-02-01 21:39:22 +05:30
Pranay Sashank
5c018c7e45 Rename Data.Array.Storable.Foreign to Data.Array.Foreign.
Closes #854.
2021-02-01 21:31:06 +05:30
Harendra Kumar
525d2b0c1d Increase heap limits for Data.Parser/Prelude.Serial 2021-01-30 20:11:58 +05:30
Harendra Kumar
95ebb7b177 Increase the memory limit for streamly-tests library 2021-01-28 01:19:44 +05:30
Harendra Kumar
7e9f2a5a5c Print more information in failing tests 2021-01-27 19:09:51 +05:30
Harendra Kumar
c30184d2da Add reverse' test 2021-01-27 19:09:51 +05:30
Adithya Kumar
e40c09ccaa Add tests for ParserD.groupByRolling 2021-01-26 20:56:25 +05:30
Adithya Kumar
9473e6bbbe Deprecate mapM and sequence in favor of rmapM and rsequence 2021-01-16 17:48:06 +05:30
Adithya Kumar
084cdea601 Rename Fold.ltake to Fold.takeLE 2021-01-16 07:12:16 +05:30
adithyaov
bdedb6949b Make the initial value of Fold a Step type
Review changes in this commit were done by Harendra Kumar (@harendra-kumar)
2021-01-15 05:02:23 +05:30
Anurag Hooda
86745a756d Rename slicesepby to slicesepbyP, some formatting changes 2021-01-14 19:17:31 +05:30
Anurag Hooda
5ccf51dcae Implement slicesepby, add tests and benchmarks 2021-01-14 19:17:31 +05:30
Anurag Hooda
05613cd6cf Fix formatting for parsers 2021-01-04 18:30:38 +05:30
Anurag Hooda
656bfc6bc8 Add tests and benchmarks for takeBetween 2021-01-04 18:30:29 +05:30
Harendra Kumar
d0f5261d76 List test suites in sorted order 2021-01-04 02:39:38 +05:30
Harendra Kumar
00a2f7b1f5 Use a basePort var, rename test, add to targets.sh
fix hlint
small cleanups
2021-01-04 02:30:20 +05:30
Ranjeet Ranjan
51774339fe Address review comments and rebase with master 2021-01-04 02:12:16 +05:30
Ranjeet Ranjan
75deef10c3 Add test cases in Unicode.Stream module
Fix hlint issues
2021-01-04 02:10:31 +05:30
Ranjeet Ranjan
198a45a57f Add test cases for Inet.TCP module 2021-01-04 02:10:31 +05:30
Ranjeet Ranjan
e82ad7eacc Add test cases for Network.Socket module
Add comment for Buffered Writer behaviour
2021-01-04 02:10:31 +05:30
Harendra Kumar
c3b506b68b Refactor, cleanup, hlint - fold and handle tests 2021-01-04 01:26:39 +05:30
Ranjeet Ranjan
0bd1586175 Add test cases for Data.Fold/Array, FileSystem.Handle
Added the following test cases to Data.Fold:

drain, drainBy, mean, stdDev, variance, mconcat, foldMap, foldMapM,
lookup, mapM, teeWithLength, teeWithMax, distribute, partition, unzip

Added the following test cases to Data.Array.Storable.Foreign

* fromList and fromListN

Added FileSystem.Handle module
2021-01-04 01:24:25 +05:30
Harendra Kumar
9522eb15df Fix -DCOVERAGE_BUILD 2021-01-01 02:06:15 +05:30
Harendra Kumar
08588c958b Use memory restrictions when building tests 2020-12-31 01:12:50 +05:30
Adithya Kumar
6bc64a47ba Add a simple test for ArrayStream.concat 2020-12-29 19:48:25 +05:30
Harendra Kumar
1b1cbbd16d Do not use threading/rts options in library 2020-12-28 23:56:18 +05:30
Harendra Kumar
f6d05d3f52 Refactor bench.sh to use build-lib.sh 2020-12-28 23:56:18 +05:30
Harendra Kumar
299bdffdd6 Add a script to run tests
This allows us to build and run individual tests or groups of tests. The
script is supposed to be extended to run hpc/coverage manually after
running the tests.

Note: cabal fails to run coverage if the test module is separated from
the library.
2020-12-28 23:56:18 +05:30
Adithya Kumar
4d3f9b41ed Implement Data.Parser.ParserD.wordBy
- Modify Data.Parser.wordBy accordingly
- Add tests for both
- Add benchmarks for both
2020-12-23 00:15:32 +05:30
Adithya Kumar
9fefed37d5 Small description fix for test:Data.Parser.takeWhile1 2020-12-17 04:21:18 +05:30
Adithya Kumar
b6ce6a3624 Implement Data.Parser.ParserD.groupBy
- Modify Data.Parser.groupBy accordingly
- Add tests for both
- Add benchmarks for both
2020-12-17 04:21:18 +05:30
Harendra Kumar
b677d0ddc9 Separate streamly tests into another package
To be able to use an internal test library, we need to have it as a
separate package. See comments in streamly-benchmarks.cabal for details.

Use a test library for common test modules
Also, added "opt" flag to control optimization levels.

Add a README for tests.
Update benchmarks readme.
2020-12-15 17:48:34 +05:30
Harendra Kumar
d5af0bfb5d Remove redundant parsers, update docs
Remove the parsers that are covered by terminating folds.
2020-12-11 18:37:59 +00:00
Adithya Kumar
c191f9c488 Add property tests for splitOn and splitOnSuffix
These tests are implemented along with splitOnSeq and splitOnSuffixSeq
2020-12-11 20:25:29 +05:30
Harendra Kumar
2888bf5ce3 Review/update docs, combinators in Fold module
Data.Fold.Types:
* Remove takeSepBy:  This function does not do what the name. Also,
`takeSepBy p` is the same as (sliceSepBy (not . p)). We can just remove
this in favor of sliceSepBy.

Data.Fold:

* Reorganize exports
* Add some skeleton/unimplemented combinators.
* Add/update haddock documentation
* Add sliceSepByMax fold - It was in parsers but it can be implemented
  as a fold.
* Rename drainSepBy to drainWhile
* Rename sliceSepWith to sliceEndWith
* Remove distribute_ as it can be implemented using distribute and has
  not perf advantage.
* Remove demuxWithDefault_ and implement demuxDefaultWith instead, which
  does not discard the results. Discarding results has no perf
  advantage.
* Implement demuxWith in terms of demuxDefaultWith, it has no perf
  advantage over the latter.
* Remove demuxWith_, use demuxWith instead.
* Remove demuxDefault_, use demuxDefault instead.
* Some code/comment cleanups

Benchmarks:

* Changes corresponding to the source changes
* Some code cleanups
* Reorder benchmarks
2020-12-11 17:23:53 +05:30
Pranay Sashank
425adca3e4 Hide failing parallel tests behind a DEVBUILD. 2020-12-06 13:57:20 +00:00
Pranay Sashank
b6fe73397d Add better tests for before and after. 2020-12-06 13:57:20 +00:00
Pranay Sashank
aba2860914 Remove duplicated test. 2020-12-06 13:57:20 +00:00
Pranay Sashank
38505ee78b Fix hlint warnings in Common, Serial test modules. 2020-12-06 13:57:20 +00:00
Pranay Sashank
dd30e2fca1 Fix formatting. 2020-12-06 13:57:20 +00:00
Harendra Kumar
b3fea143aa Fix partial eval tests for bracket/finally
Added a small delay to let the cleanup run.
2020-12-06 13:57:20 +00:00
pranaysashank
48c640408d Fix failing build on GHC < 8.6. 2020-12-06 13:57:20 +00:00
pranaysashank
60a72a0f62 Add test for zipAsyncApplicative. 2020-12-06 13:57:20 +00:00
pranaysashank
7263bf5c90 Add construction tests for serial streams. 2020-12-06 13:57:20 +00:00
pranaysashank
a6341ee5ec Add test for drainWhile. 2020-12-06 13:57:20 +00:00
pranaysashank
a94dc1278c Add test for handle. 2020-12-06 13:57:20 +00:00
pranaysashank
2701894400 Add test for onException and finally. 2020-12-06 13:57:20 +00:00
pranaysashank
edab41601c Add tests for bracket. 2020-12-06 13:57:20 +00:00
pranaysashank
babd1a2974 Add tests for before and after. 2020-12-06 13:57:20 +00:00
pranaysashank
5fe15b9bcc Add test for concatMapM and concatUnfold. 2020-12-06 13:57:20 +00:00
pranaysashank
b223994b26 Add test for groupsByRolling. 2020-12-06 13:57:20 +00:00
pranaysashank
bee479ea04 Add test for S.groups. 2020-12-06 13:57:20 +00:00
pranaysashank
d8a2bba2e6 Add construction tests.
- Add constructWithYield, yieldM, repeat, repeatM, enumerate,
enumerateTo, fromList, fromListM, zipAsyncApplicative.
2020-12-06 13:57:20 +00:00
pranaysashank
57f43838a5 Add tests for cons, consM, .:, |:. 2020-12-06 13:57:20 +00:00
Harendra Kumar
a187768fac
Merge pull request #795 from composewell/terminatin-folds-2
Enhance the fold type to capture terminating folds
2020-12-06 10:52:15 +05:30
Harendra Kumar
e36bfcfff7 Move/reorg some code, use base ver instead of GHC 2020-12-02 10:01:31 +00:00
Ranjeet Ranjan
fe33167ea6 Fix Windows build issues 2020-12-02 07:39:05 +00:00
Harendra Kumar
48e9b1ad89 Refactor test driver 2020-12-02 07:39:05 +00:00
Harendra Kumar
583149c1ed Refactor to move events along with the test
That way its easier to understand what the test is doing, at one place.
2020-12-02 07:39:05 +00:00
Harendra Kumar
e085852068 Move fs ops to test description table
* factor out the common "dispatch" part.
2020-12-02 07:39:05 +00:00
Harendra Kumar
bb4b378bab Factor out common code from event handlers 2020-12-02 07:39:05 +00:00
Ranjeet Ranjan
5ead27a1c4 Refactor to common dispatch function for FSops 2020-12-02 07:39:05 +00:00
Ranjeet Ranjan
d21c0b7f22 Factor out duplicate code to common function 2020-12-02 07:39:05 +00:00
Ranjeet Ranjan
ce2426d175 Fix CI build issues
Fix Semigroup import for GHC 8.2.2 and Windows build issues.
2020-12-02 07:39:05 +00:00
Harendra Kumar
b85002bddb Simplify the implementation
* Do not use a seperate traversal of dirs, instead just call addToWatch
  recursively.
* Keep rel path of subdir in the map instead of keeping absolute path
* Keep the same default for recursive watch on Windows/Linux
* Use watchTreesWith to implement watchPathsWith using recursive flag

Refactor, add some todos for test code
2020-12-02 07:39:05 +00:00
Ranjeet Ranjan
f00008b321 Add recursive directory tree events in Linux 2020-12-02 07:39:05 +00:00
adithyaov
8f7c0ddd1e Modify the current Fold type to handle terminating Folds
This commit also includes:
- Changing all other modules accordingly.
- Adding additional helper functions to make life easy
- Using strict types as fold's intermediate result
- Respecting line length of 80 in most cases
2020-12-02 02:21:29 +05:30
Harendra Kumar
cd3ce3e503 Fix formatting and docs
* Use let clauses to break bigger expressions
* Use `even` as predicate
2020-11-26 17:11:47 +05:30
Ranjeet Ranjan
60d13da0d6 add mapMaybe combinator in Fold
Add benchmarking and test case for mapMaybe combinator of Data.Fold

Fix review comments
2020-11-26 17:11:47 +05:30
pranaysashank
8016730649 Rename test modules to match with corresponding source modules. 2020-11-17 17:50:29 +05:30