Commit Graph

798 Commits

Author SHA1 Message Date
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
de083af8e7 Group merging and subsequences benchmarks. 2018-11-22 10:17:15 +05:30
Pranay Sashank
04907e303e Remove splitAt. 2018-11-22 10:07:12 +05:30
Pranay Sashank
5fc469ad77 Add uniq, indexed, indexedR. 2018-11-22 10:03:46 +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
9ccee33329 Use substream functions from StreamD not the imported Stream. 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
55e582efaf INLINE insert and delete in benchmarks. 2018-11-22 10:02:04 +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
Harendra Kumar
5e38a5715f simplify mergeBy implementation 2018-11-22 09:55:05 +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
6daacf0d49 Add foldl' benchmark for pure streams to cmp with Foldable 2018-11-19 12:44:53 +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
9e114ffa2f define IsList instances for GHC 8.0 and below 2018-11-19 08:55:20 +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
7527247381
Merge pull request #124 from Abhiroop/foldable-traversable
Add Foldable and Traversable instances for StreamD and StreamK
2018-11-16 13:59:29 +05:30
Harendra Kumar
2228ab0eb5 Add references to async 2018-11-10 03:37:16 +05:30
Harendra Kumar
4b75877900 Fix example code in Prelude 2018-11-10 03:37:03 +05:30
Harendra Kumar
4df1a938e4 change the INLINE phase of scanlM' to NORMAL 2018-11-06 07:02:04 +05:30
Harendra Kumar
adf667a5ea use -fspec-constr-recursive=10 flag for benchmarks 2018-11-06 06:43:43 +05:30
Harendra Kumar
325842fb24 Enable inlining of mapMaybeM serial implementation 2018-11-06 06:20:59 +05:30
Harendra Kumar
58e8d397f5 Use scanl' from the imported stream (D or K)
It was earlier hardcoded to use D.
2018-11-06 06:20:59 +05:30
Harendra Kumar
734004b570 use dev flag when using the base stream benchmarks 2018-11-06 05:35:59 +05:30
Harendra Kumar
3d79168e4b Add isolated benchmarks to investigate special cases 2018-11-06 04:36:41 +05:30
Harendra Kumar
bf4e5d89ec Add mixed ops x 2 and iterated benchmarks to base
Also, fix comparative graph generation, titles etc.
2018-11-06 03:12:08 +05:30
Harendra Kumar
6279c37f9a Fix reports for StreamD/K
We want single group reports with diffs.
2018-11-06 00:58:59 +05:30
Harendra Kumar
628355fad6 Improve benchmarking of base streams
1) Fix options parsing in charting program
2) Add a group-diff options to compare StreamD/K
3) Add more benchmarks to StreamD/K
2018-11-05 20:34:20 +05:30
Harendra Kumar
58e81952e3 Add pull request checklists 2018-11-05 16:37:46 +05:30
Harendra Kumar
bb56f1757e refactor stream level combinators in another module 2018-11-05 16:34:40 +05:30
Harendra Kumar
c8ae480511
Merge pull request #115 from Abhiroop/skip
Add a skip constructor to the stream type
2018-11-05 05:34:02 +05:30
Abhiroop Sarkar
81cf15b9f6 Add Skip constructor to the core Stream type to enhance stream fusion
Introduce the skip constructor and fix the simpler warnings with some slight refactorings.

Add alternate definitions of filtering operations.

Revert `all` to the original definition

1. Implement the fromStreamK and zipWithM methods
2. Uncomment the linear benchmarks

Cleanup and add some stylistic changes

Add alternate implementation of drop function
2018-11-02 22:04:07 +05:30
Abhiroop Sarkar
159a0d2e50 Derive Foldable and Traversable instance for all the newtype wrappers around streams 2018-11-02 21:45:28 +05:30
Abhiroop Sarkar
977c344600 Add Foldable and Traversable instances for StreamD and StreamK 2018-11-02 14:08:34 +05:30
Harendra Kumar
c7666a7caa
Merge pull request #112 from mgsloan/documentation-adjustments
Documentation adjustments
2018-11-02 03:01:17 +05:30
Michael Sloan
c0bcda8c12 Spelling fixes + other misc tutorial adjustments 2018-11-01 14:26:43 -07:00
Harendra Kumar
64ddfd8bcc describe all labels in a separate section 2018-10-31 20:14:55 +05:30
Harendra Kumar
c8aaba38cb Add dropWhileFalse/dropOne
Also, disable monadic versions of drop/take.  Pure versions use the monadic
ones internally so the monadic benchmarks are redundant unless we change the
implementations in future.
2018-10-31 16:50:00 +05:30
Harendra Kumar
3524799d3d Sort on time taken in solo reports
Sorting allows us to immediately identify the ops with worst timings to be
picked up for improvement.
2018-10-31 16:47:16 +05:30
Harendra Kumar
ab1d6f388a use bench-show-0.2.2 2018-10-31 14:44:37 +05:30
Harendra Kumar
114ab1f8cf fix some hlint warnings 2018-10-31 01:53:19 +05:30
Harendra Kumar
e3f9f255da update changelog 2018-10-31 01:14:02 +05:30
Harendra Kumar
b4f9c6912e Add benchmarks iterating the same op multiple times 2018-10-31 01:14:02 +05:30
Harendra Kumar
fcaf8bb7fa INLINE cons and scanlM' 2018-10-30 06:35:54 +05:30
Harendra Kumar
172efa6582 Add composed benches for streamd/k and compare them 2018-10-29 19:02:41 +05:30
Harendra Kumar
615197d1c5 split head and tail benchmarks from nullHeadTail 2018-10-29 13:19:59 +05:30