* 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.
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.
rename toArray/toArrayN to writeF/writeNF to keep the API name consistent with
their regular counterparts. Now the only difference in fold APIs is a suffix F.
- Hides Pipe, FileSystem.FD, FileSystem.File, Time.Units,
Time.Clock modules.
- Hides transform function from Fold, Prelude modules.
- Change examples depending on File api, and do not build
FileIOExamples.
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
* Streamly.FileSystem.FD module for unbuffered IO. Buffering can be controlled
from the stream itself.
* Support IO using writev as well
Array APIs include:
* coalesceChunksOf to coalesce smaller arrays in a stream into bigger ones
* unlinesArraysBy to join a stream of arrays using a line separator
* splitArraysOn to split a stream of arrays on a separator byte
We were using bracket on a loop which iterates very frequently. Instead use it
on an outer loop which is much leass frequent.
Also add FileIO.hs to test drive the performance of FileIO APIs.
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.