on master help sign in
update README and Changelog
commitb9bfd202cb4516578a50a25bee6a23c30d186d9a authorHarendra Kumar <harendra.kumar@gmail.com> dateSat 25 Aug 2018, 08:48 (8 years ago) parent3b1f3dd
2 files changed+26−3
Changelog.md+4−3 README.md+22
Changelog.md+4−3
@@ -2,18 +2,19 @@
22
33### Bug Fixes
44
5+* Leftover threads are now cleaned up as soon as the SVar is garbage
6+ collected.
57* Fix a bug in concurrent function application that in certain cases would
68 unnecessarily share the concurrency state resulting in incorrect output
79 stream.
8−* Leftover threads are now cleaned up as soon as the SVar is garbage
9− collected.
1010* Fix passing of state across parallel, async, wAsync, ahead, serial, wSerial
1111 combinators. Without this fix combinators that rely on state passing e.g.
1212 `maxThreads` and `maxBuffer` won't work across these combinators.
1313
1414### Enhancements
1515
16−* Added rate limiting combinator `rate` to control the yield rate of a stream.
16+* Added rate limiting combinators `rate`, `avgRate`, `minRate`, `maxRate` and
17+ `constRate` to control the yield rate of a stream.
1718* Add `foldl1'`, `foldr1`, `intersperseM`, `find`, `lookup`, `and`, `or`,
1819 `findIndices`, `findIndex`, `elemIndices`, `elemIndex`, `init` to Prelude
1920
README.md+22
@@ -307,6 +307,28 @@ The concurrency facilities provided by streamly can be compared with
307307[Cilk](https://en.wikipedia.org/wiki/Cilk) but with a more declarative
308308expression.
309309
310+## Rate Limiting
311+
312+For bounded concurrent streams, stream yield rate can be specified. For
313+example, to print hello once every second you can simply write this:
314+
315+``` haskell
316+import Streamly
317+import Streamly.Prelude as S
318+
319+main = runStream $ asyncly $ avgRate 1 $ S.repeatM $ putStrLn "hello"
320+```
321+
322+For some practical uses of rate control, see
323+[AcidRain.hs](https://github.com/composewell/streamly/tree/master/examples/AcidRain.hs)
324+and
325+[CirclingSquare.hs](https://github.com/composewell/streamly/tree/master/examples/CirclingSquare.hs)
326+.
327+Concurrency of the stream is automatically controlled to match the specified
328+rate. Rate control works precisely even at throughputs as high as millions of
329+yields per second. For more sophisticated rate control see the haddock
330+documentation.
331+
310332## Reactive Programming (FRP)
311333
312334Streamly is a foundation for first class reactive programming as well by virtue