Commit Graph

161 Commits

Author SHA1 Message Date
Harendra Kumar
6225379eb6 Hide the "array stream" Handle IO APIs
These can possibly be expressed in terms of the generic polymorphic IO APIs
once we have those. For now we can use these from the Internal module.
2019-10-15 00:40:15 +05:30
Harendra Kumar
58d1d61afd Use unfolds instead of streams for array reading 2019-10-15 00:40:15 +05:30
Harendra Kumar
16c2f015c2 rename "runFold" to "fold"
* 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.
2019-09-29 14:52:29 +05:30
Harendra Kumar
db0a150df4 Enable FileSystem.File module example 2019-09-26 01:36:19 +05:30
Harendra Kumar
b8b3e17eef stop exporting ArrayStream APIs from Array module
This module is now only for convenience as all APIs can be expressed in terms
of Stream APIs with the same performance.
2019-09-26 01:36:19 +05:30
Harendra Kumar
ae847b821f remove fold API exports from Streamly.Internal
They are now exported via Streamly.Internal.Data.Fold
2019-09-24 21:14:51 +05:30
Harendra Kumar
042b677592 Move Streamly.Fold module
* Move exposed Streamly.Fold to Streamly.Data.Fold
* Move the internal implementation to Streamly.Inetrnal.Data.Fold
2019-09-24 21:14:51 +05:30
Harendra Kumar
349c9d7a64 Use an IORef for the counts in hashmap
This reduces the garbage generated by frequently updating the hashmap.
2019-09-18 10:26:14 +05:30
Harendra Kumar
7d9c88b06f Use String instead of Array as word type
improves performance and memory utilization significantly.
2019-09-10 15:36:51 +05:30
Harendra Kumar
d1a12545ae Fix orphan instance warning 2019-09-10 15:18:12 +05:30
Harendra Kumar
6f3fda8a4a Make toLower and isAlpha more efficient 2019-09-06 23:02:22 +05:30
Harendra Kumar
b9e99db0bd Add word classifier example 2019-09-06 00:38:53 +05:30
Harendra Kumar
d56382883e fix redundant constraints 2019-08-23 13:02:38 +05:30
Harendra Kumar
1bfca9e46c merge the ArrayStream module to Array module itself
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.
2019-08-17 05:13:48 +05:30
Harendra Kumar
8f96100ab5
Merge pull request #258 from composewell/doc-rename
Update documentation and rename some combinators
2019-08-14 05:52:27 +05:30
Harendra Kumar
d030361697 Fix renaming of splitBySuffix to splitWithSuffix 2019-08-14 04:17:34 +05:30
Harendra Kumar
fc957922ac rename splitBySuffix to splitWithSuffix
"With" gives a better idea that we are keeping the suffix.
2019-08-13 15:47:40 +05:30
Harendra Kumar
f21a5b8130 rename concatMapBy to concatMapWith
This is consistent with foldMapWith.
2019-08-13 15:20:39 +05:30
Pranay Sashank
d26ab21364 Move Streamly.String to Streamly.Data.String. 2019-08-13 13:09:22 +05:30
Harendra Kumar
53d5e9f0e1 update for fold based IO 2019-08-12 07:13:26 +05:30
Harendra Kumar
06b0cb1328 Implement IO write operations as folds. 2019-08-12 07:13:26 +05:30
Pranay Sashank
07e954820d Refactor readArraysOfUpto to readArraysOf in Socket, Handle, File.
- And also in examples, benchmarking code.
2019-08-07 00:22:26 +05:30
Pranay Sashank
bda6a6415b Refactor modules Mem.* ~> Memory.* and update references. 2019-08-06 04:31:23 +05:30
Harendra Kumar
2438be4259 rename the Mem.Array.Stream module to Mem.ArrayStream 2019-08-06 02:55:06 +05:30
Harendra Kumar
e621237b79 update documentation and rename toArray => write
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.
2019-08-06 02:28:14 +05:30
Harendra Kumar
a740d4dba9 move stream transformation operations to Prelude 2019-08-03 23:15:26 +05:30
Harendra Kumar
3cdecba40c Create a separate module for "Streams of Arrays" 2019-08-03 08:16:23 +05:30
Harendra Kumar
ea342a40c5 Fix HandleIO example 2019-08-03 05:16:59 +05:30
Harendra Kumar
bba704561b fix warnings, example and readme 2019-08-03 05:16:59 +05:30
Pranay Sashank
8fa60a9fad Fixup, revert changes to examples/FileIOExamples.hs. 2019-07-30 19:27:02 +05:30
Pranay Sashank
ea668dc99b Hide modules not finalised for 0.7.0.
- 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.
2019-07-30 14:36:18 +05:30
Harendra Kumar
b9dbfaa4f5 rename fileio example to avoid conflict with fileio benchmark 2019-06-18 20:51:21 +05:30
Harendra Kumar
cf2d81091b simplified byte stream versions, remove warnings 2019-06-15 19:01:09 +05:30
Harendra Kumar
dbaacea1c6 implement fromStreamDArraysOf more efficiently
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
2019-06-15 19:01:09 +05:30
Harendra Kumar
694eab4e6a Raw IO w/o buffering, add some array APIs
* 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
2019-06-15 19:01:09 +05:30
Pranay Sashank
254f27fde8 Add unlines, unwords, tests for lines/unlines and words/unwords. 2019-06-12 10:30:15 +05:30
Harendra Kumar
d0bba7667b Add toArray fold to fold a stream into a single array 2019-06-02 05:36:02 +05:30
Harendra Kumar
b70a369ccd Add append example 2019-06-01 04:11:57 +05:30
Harendra Kumar
22ccf96a17 Add withSocket, add networking examples to cabal file 2019-05-31 15:01:14 +05:30
Harendra Kumar
81d8c27b31 Add the Network.Client module 2019-05-31 14:06:58 +05:30
Harendra Kumar
a2e76766c3 Split the server combinators in a separate module 2019-05-31 12:43:26 +05:30
Harendra Kumar
fc6d77a025 Fix a performance issue with File.read
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.
2019-05-31 09:49:32 +05:30
Harendra Kumar
e19003266d rename FileIO.hs example file to HandleIO.hs 2019-05-31 09:46:53 +05:30
Harendra Kumar
2b120d2445 fix file-io example to use Handle module 2019-05-30 13:10:28 +05:30
Harendra Kumar
75ef6c21c1 sync server example with changes in the library
Use the file API instead of handle API
2019-05-30 12:10:37 +05:30
Harendra Kumar
68690bb4ed update client/server examples 2019-05-29 09:59:05 +05:30
Harendra Kumar
f1e2f03766 update and add networking examples 2019-05-28 10:13:35 +05:30
Harendra Kumar
43a6e751e2 Add socket IO API with examples 2019-05-27 07:03:15 +05:30
Harendra Kumar
25dacda03b Add file-io example 2019-05-22 07:08:34 +05:30
Harendra Kumar
fd7bd713ec Add "Streamly.Fold" module 2019-05-13 12:21:16 +05:30
Harendra Kumar
09fddfa1f3 fix streamK build and examples build 2019-05-04 10:08:09 +05:30
Harendra Kumar
d9b0b79e46 update copyright notice 2019-05-02 15:54:54 +05:30
Mariusz Ryndzionek
7916932416 Removed redundant imports 2019-03-03 13:45:08 +01:00
Harendra Kumar
5fe13b0ef5 update examples and documentation 2018-12-30 22:14:51 +05:30
Harendra Kumar
67600c03b0 Add some convenient runner functions 2018-12-29 16:22:29 +05:30
Harendra Kumar
f6ffd35db8 Do not use exceptions for error handling 2018-12-29 16:22:29 +05:30
Harendra Kumar
114ab1f8cf fix some hlint warnings 2018-10-31 01:53:19 +05:30
Harendra Kumar
165f2a23aa Add control-flow monad transformers' examples 2018-10-26 20:01:28 +05:30
Harendra Kumar
354f7615fa lint free examples 2018-10-13 13:15:22 +05:30
Harendra Kumar
0ef728a55f remove the Quit constructor 2018-10-10 12:39:27 +05:30
Harendra Kumar
482b971ebb make custom rate combinators functions
instead of constructors
2018-08-25 04:51:00 +05:30
Harendra Kumar
aa8345d0d4 Add avg/min/max/const/rate specifications for rate 2018-08-23 06:58:03 +05:30
Harendra Kumar
9c85811905 rename "once" to "yieldM"
and some other related refactoring changes.
2018-06-23 06:50:59 +05:30
Harendra Kumar
328365e5e4 update documentation 2018-06-15 00:44:15 +05:30
Harendra Kumar
54419aa5c3 remove redundant liftIO 2018-05-29 12:51:38 +05:30
Harendra Kumar
21758e09a3 use aheadly in the Listdir example 2018-05-21 06:02:46 +05:30
Harendra Kumar
56cb8e6981 Fix nomenclature in examples 2018-05-13 10:48:18 +05:30
Harendra Kumar
091f4b69fe Add the strictly parallel stream type ParallelT 2018-05-08 07:49:43 +05:30
Harendra Kumar
b214a85407 remove redundant re-exports 2018-05-04 02:04:15 +05:30
Harendra Kumar
c5f97f0e3b Move examples from Streamly module to examples dir 2018-05-04 01:28:02 +05:30
Harendra Kumar
f3dbbde613 move example files 2018-05-04 01:28:02 +05:30
Harendra Kumar
7febfe948d Add consM, once and |:, fixes #51 2018-05-02 15:39:38 +05:30
Harendra Kumar
12b970cdd6 Add stream types specialized to IO monad 2018-04-25 11:31:12 +05:30
Harendra Kumar
a526207acd rename the default stream type to StreamT
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".
2018-04-25 11:31:12 +05:30
Harendra Kumar
30a6e32fee Fix Monoid and other instances
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.
2018-04-22 15:59:09 +05:30
Harendra Kumar
3f638d9b6d rename interleave=>coserial, aparallel=>coparallel 2018-04-18 16:55:16 +05:30
Harendra Kumar
3bb7ff10c5 Use only runStream to run streams with optional combinators 2018-04-18 15:26:15 +05:30
Harendra Kumar
3d920ef3f8 rename AsyncT to AParallelT
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.
2018-04-17 18:03:27 +05:30
Harendra Kumar
dffb02fa98 Fix examples to use new names 2018-04-17 15:45:24 +05:30
Harendra Kumar
5c5b2b3ed8 rename all references to StreamT to SerialT 2018-04-15 15:05:59 +05:30
Harendra Kumar
49a5ba4fa6 Remove redundant examples 2017-12-03 00:48:24 +05:30
Harendra Kumar
20cc04bb23 Add note about the canonical examples 2017-11-21 02:50:15 +05:30
Harendra Kumar
a74a0c0844 Rename to Streamly
Streamly is a more appropriate name and conveys the core idea. Stream
concurrently = streamly.
2017-11-20 18:03:13 +05:30
Harendra Kumar
2d3ccadb5d fix example 2017-10-30 07:50:08 +05:30
Harendra Kumar
10b05b545e Fix examples 2017-10-26 13:06:47 +05:30
Harendra Kumar
7e3465d35b Move examples to Asyncly.Examples module 2017-10-21 01:49:14 +05:30
Harendra Kumar
27602de893 Add examples to cabal file 2017-10-18 11:51:38 +05:30
Harendra Kumar
f1d5f2e53a Add a circling square example from the Yampa package 2017-10-18 02:33:21 +05:30
Harendra Kumar
cef2f7da14 update examples 2017-10-17 02:48:36 +05:30
Harendra Kumar
49d4c157bd rename next to uncons 2017-10-16 08:28:37 +05:30
Harendra Kumar
6c061c4628 Add mergesort example 2017-10-16 07:55:48 +05:30
Harendra Kumar
e560d9140d replace error with fail 2017-09-18 16:07:52 +05:30
Harendra Kumar
65ca7691c0 Fix loop example 2017-09-14 19:15:23 +05:30
Harendra Kumar
0bde21205a Use cycle1 2017-09-11 18:07:20 +05:30
Harendra Kumar
0acab07162 Add the fastest search engine example 2017-09-07 21:04:06 +05:30
Harendra Kumar
deec84bbee Add a reactive game example 2017-09-06 08:53:20 +05:30
Harendra Kumar
76eaffddfb update listdir example 2017-08-31 06:32:31 +05:30
Harendra Kumar
036437ce91 implement fair interleaving of parallel tasks 2017-08-30 14:58:28 +05:30
Harendra Kumar
07c13575d0 rename operators 2017-08-29 11:31:19 +05:30
Harendra Kumar
c81684d415 Add left biased combinator and some utilities
Remove 'for' and 'each'
2017-08-29 10:44:03 +05:30