Commit Graph

1096 Commits

Author SHA1 Message Date
Harendra Kumar
6bf8b4abd9 Rename the parser Step constructors
Yield => Partial
Skip => Continue
Stop => Done

The new names are hopefully more intuitive. They also decouple the names from
the corresponding stream constructors so that there is no confusion about
mixing the two intuitions.

fixes #559
2020-06-24 21:07:08 +05:30
Harendra Kumar
60d322812b Combine Yield and YieldB constructors
Yield 0: now means a partial result is available
Yield n: means a partial result is available, and we need to backtrack by n
elements.
2020-06-24 21:06:56 +05:30
Harendra Kumar
55d49bd50c Optimize Functor/Applicative/Monad etc for serial
Some of the benchmarks were order of magnitude off due to missing INLINE for
type class operations. Now, all of them are in reasonable limits. Benchmarks
affected for serial streams:

* Functor, Applicative, Monad, transformers

We need to do a similar exercise for other types of streams and for
folds/parsers as well.
2020-06-23 13:41:41 +05:30
Harendra Kumar
b4cef11d19 Add iterative benchmarks for Functor/transformers
* Also factor out the existing iteration utilities and use the same everywhere
2020-06-23 13:01:25 +05:30
Harendra Kumar
1cccb00101 Use foldrSShared instead of foldrS for Async
Because of not sharing the SVar foldrS performs poorly for Async streams and
has quadratic complexity.
2020-06-21 11:28:59 +05:30
Harendra Kumar
acf31cef50 Import from transformers instead of mtl
Just so that we know where all we are actually using mtl.
2020-06-20 18:56:03 +05:30
Sanchayan Maity
b5cf9dd9a7 Streamly: Internal: Data: Clean up hlint warnings
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
2020-06-06 01:37:07 +05:30
Harendra Kumar
b90107f15b Fix build for older versions of GHC 2020-06-03 23:30:04 +05:30
Pranay Sashank
959fcc7eec Fix Parser.eqBy. 2020-06-02 19:23:22 +05:30
Pranay Sashank
12ca6eeba5 Fix sliceSepByMax. 2020-06-02 18:03:43 +05:30
Harendra Kumar
df6d8e0b04 Make changes to unfolds from stream
* Add fromStreamK
* fromStream: signature change, use fromStreamK as fromStreamD has very bad
  performance characterstics.
* Add INLINEs to fromStream
* Remove fromStream1 and fromStream2 as they can be expressed trivially in
  terms of fromStream and lmap.
2020-06-02 11:20:38 +05:30
Harendra Kumar
01fa925af3 rename mconcatTo to sconcat 2020-05-31 01:46:01 +05:30
Harendra Kumar
ef9a671c67 Create arrays from Addr# (unboxed string literals) 2020-05-29 23:48:34 +05:30
Harendra Kumar
3e22f1bae0 flush sessions when classifySessionsOf ends
Earlier the sessions that were incomplete and in the hash were dropped when the
stream ended.
2020-05-29 17:08:39 +05:30
Harendra Kumar
b52ed84a33 Make classifySessionsOf terminate
It was running forever as the timer stream never terminated.
2020-05-28 19:14:56 +05:30
Harendra Kumar
602539f613 Add/change some time/interspersing combinators
Add: intersperseSuffix_, delay, timeIndexed
Change the APIs: times, absTimes, relTimes, timestamped

The new APIs have a default clock granularity of 10 ms.
2020-05-28 16:26:59 +05:30
Harendra Kumar
e511962625 Fix conversion of MicroSecond64 and MilliSecond64 2020-05-28 10:07:41 +05:30
Harendra Kumar
7013f3a5e4 Fix delayPost, add more interspersing combinators
delayPost was actually behaving like delayPre, fixed it.
Added: trace_, intersperseM_, interspersePrefix_, delayPre
2020-05-27 19:26:26 +05:30
Harendra Kumar
7f9d4a4210 Add some time related combinators
add: times, relTimes, timestamped
unimplemented skeletons: durations, ticks, timeout

Changes to the original currentTime combinator: remove delay from the first
event, cap the granularity to 1 ms to guarantee reasonable cpu usage.
2020-05-27 12:21:54 +05:30
Pranay Sashank
9e6d245a3e Remove extraneous file Streamly.Examples 2020-05-18 10:48:45 +05:30
Ahmed Zaheer Dadarkar
64e8b3801a updated definition of parseK to use throwM instead of error 2020-05-16 14:30:56 +05:30
Harendra Kumar
df553b1d5b fix hlint warnings
and remove fixed files from .hlint.ignore
2020-05-15 10:18:59 +05:30
Sanchayan Maity
c9eff7e271 Cleanup hlint warnings
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
2020-05-15 10:11:06 +05:30
Harendra Kumar
e84612f179 Add connect and connectFrom 2020-05-12 05:55:15 +05:30
Harendra Kumar
96aa91d2a4 Close the socket on exception
in "accept" and "connections"
otherwise it will be closed only on garbage collection.
2020-05-12 05:55:15 +05:30
Harendra Kumar
d0b558e521 close socket on exception (in connect) 2020-05-12 05:55:15 +05:30
Harendra Kumar
40d1e6423d Fix a bug in YieldB case 2020-05-11 21:25:24 +05:30
Harendra Kumar
2c9feb48ef Add YieldB (yield and backtrack) constructor
This fixes an issue in many/some/manyTill combinators.
2020-05-11 21:25:24 +05:30
Harendra Kumar
633c55eb31 rename splitParse/parseMany, concatParse/parseIterate 2020-05-11 21:18:09 +05:30
Harendra Kumar
1889b4eef6 update fold documentation 2020-05-11 21:17:32 +05:30
Harendra Kumar
684d2786eb Add concatParse to chain parsers on a stream
Add mconcatTo, update fold docs
Add fold docs/snippets using Monoids.
Add benchmark for sum using foldMap
Add concatParse benchmark
Add splitParseTill, update docs
2020-05-11 20:54:22 +05:30
Shruti_Umat
0911988b4e explain mapM, sequence functions 2020-05-04 12:06:31 +05:30
Shruti_Umat
3957ceed99 fix output explanation of wAsyncly
typo fix in StreamD coding style
2020-05-04 12:06:31 +05:30
Harendra Kumar
7af52d33b7 remove duplicate code 2020-04-24 04:29:12 +05:30
Harendra Kumar
9d4e6a2036 Fix exception handling
Check for ParseError exception instead of SomeException
Fix some comments.
2020-04-24 04:15:27 +05:30
Harendra Kumar
899cab5cd4 Make License Identifier SPDX compliant 2020-04-24 03:57:46 +05:30
Harendra Kumar
d7866f732d INLINE some/many implement *>/<*
Benchmarks that improved:

ParserK(cpuTime)
Benchmark                   default(0)(μs) default(1) - default(0)(%)
--------------------------- -------------- --------------------------
o-n-heap/parserK/sequenceA_       11183.17                     -32.75
o-n-heap/parserK/manyAlt          41514.00                     -40.82
o-n-heap/parserK/someAlt          68026.25                     -61.77
2020-04-24 02:59:40 +05:30
Harendra Kumar
dde9041833 Use parserK by default and rewrite to ParserD 2020-04-24 00:30:01 +05:30
Harendra Kumar
a03e2872a6 rename Parser module to ParserD
The top level module "Parser" will be using both ParserK and ParserD.
2020-04-24 00:30:01 +05:30
Harendra Kumar
12fef4390f Add a CPS style parser implementation
CPS performs much better for parsing operations like "sequence" and
"choice" on large containers. Given that applicative "sequence" does
not scale, I guess the Monad instance as well won't scale for direct
implementation.
2020-04-24 00:30:01 +05:30
Pranay Sashank
828a564781 Add GHC 8.10.1 build to CI.
- Disable inspection testing for `fromStreamVar`.
- Fix overlapping pattern matches warning in test/Main.hs.
2020-04-22 14:32:30 +05:30
Harendra Kumar
f51bbb25bd Rename some parsers and add some TBD and comments 2020-04-16 23:11:49 +05:30
Harendra Kumar
e6d4570ccd Add isAsciiAlpha 2020-04-16 23:11:36 +05:30
Harendra Kumar
007343a84e Add eqBy to match a sequence 2020-04-16 23:11:29 +05:30
Harendra Kumar
c8bbb0a1c8 Add lookAhead 2020-04-16 23:11:22 +05:30
Harendra Kumar
3622e37b4e Add takeWhile1 2020-04-16 23:11:14 +05:30
Harendra Kumar
5e8f2c7a13 Add documentation on Fold/Parser design 2020-04-16 22:24:26 +05:30
Harendra Kumar
88e55f7051 Add Monad and MonadPlus instances 2020-04-16 21:15:02 +05:30
Harendra Kumar
efebe0f11f Add FUSE annotations to "tee" state constructors 2020-04-14 23:34:08 +05:30
Harendra Kumar
202c33d6e8 Add Alternative instance, combinators and parsers
parsers: peek, satisfy, eof, yield, yieldM, die, dieM
combinators: shortest, longest, alt, many, some, manyTill
2020-04-14 23:34:08 +05:30