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.
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.
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
- 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
The trigger for this change is that parallel stream is not really parallel it is
a concurrent lookahead like just in a different traversal style. So we make
parallel and coparallel as parAhead and coparAhead instead and later introduce
a new style for parallel which would be strictly parallel with one thread for
each stream started right away rather than speculatively.
This was earlier changed from StreamT to SerialT. However we have made this the
default type now and it makes more sense to call it StreamT now. A bigger
motivation for the change is that StreamT immediately conveys that it is a
stream which is helpful and intuitive for new learners. Also we have a plan to
have a specialized type called "Stream a = StreamT IO a", so the name StreamT
is in line with that common default type "Stream a". Calling that type as
"Serial a" does not sound as intuitive as calling it "Stream a".
Monoid instances should not be derived from underlying type where we want them
to be type specific. Added tests to make sure they are correct.
Other typeclass instances that are dependent on type specific behavior should
also be independently defined rather than derived.
Removed Alternative instances as they are not correct yet.
Removed redundancy by using CPP macros to define instances of different types.