Split performStream into functions handling stream of futures#68
Split performStream into functions handling stream of futures#68
Conversation
e9cc723 to
553aefd
Compare
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## master #68 +/- ##
==========================================
+ Coverage 95.79% 96.25% +0.45%
==========================================
Files 13 13
Lines 1476 1494 +18
Branches 130 135 +5
==========================================
+ Hits 1414 1438 +24
+ Misses 62 56 -6
Continue to review full report at Codecov.
|
|
Here's a diagram, inspired by the one @stevekrouse did in #57 that tries to show the difference between the |
| language: node_js | ||
| node_js: | ||
| - "node" | ||
| - "8" |
There was a problem hiding this comment.
Some of the test implementations use Array#flatMap which this old NodeJS version does not support.
|
Really nice work 😄 My only comment is that I don't find the name Future<Future<A>> -> Future<A>where the actual type is: Stream<Future<A>> -> Now<Stream<A>>the only difference in the naming is the addition of
It is nice grouping functions which are sharing properties together, but I find it more important to use a name, which describes the behavior of a function rather then the properties of a function and I also believe it to be easier to remember. Instead I suggest something like |
|
I think Not only are the types similar. The behavior is also very similar. On top of the useful analogy with On the other hand I don't think |
553aefd to
ba08ae5
Compare
|
I've renamed |

This PR changes
into
In other words, there is now a single function for running a stream and it results in a stream of futures. To flatten/unnest this stream of futures one then has to use one of the three new functions for doing so. But, these new functions can be used in any circumstance where one has a stream of futures.
We can discuss the names of the last three function. The logic behind the current names is that
flatis a function that turnsM<M<A>>intoM<A>while satisfying things likeflat(map(v => M.of(v)) === vand the new functions are similar in thatflatFutureturns aStream<Future<A>>into aStream<A>while satisfying things likeflatFuture(map(v => Future.of(v), stream)) === stream. Hence the idea is that highlighting the similarity by using a familiar word "flat" will make it easier to understand and remember what this new function does.Related to: funkia/purescript-hareactive#3