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.
- 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.
Also rename asyncly to aparallely and runAsyncT to runAParallelT
The name Async is confusing and does not convey the right meaning. The 'A' in
AParallelT stands for 'Adaptive' and 'Parallel' indicates that this is a
variant of Parallel.
Another choice for the name was 'MParallelT' where 'M' stands for 'maybe', it
is maybe parallel since it may or may not start parallel threads depending on
demand but Adaptive fits better as it adapts to the demand.