-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a purity breakage in unconsAsync
, resulting in wild behaviour
#1037
Conversation
type Res = Option[(Segment[O,Unit], Stream[F,O])] | ||
|
||
Pull.eval(Promise.empty[F, Either[Throwable, Res]]) flatMap { p => | ||
Pull.fromFreeC { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could inline this Pull
:
Pull.fromFreeC { Algebra.eval[F, Nothing, Promise[F, Res]](async.Promise.empty).flatMap { p =>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's a good idea, I'll do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, the whole operation seems quite similar to start
, so maybe it's worth thinking for a while how to make it a bit nicer
About tests: there only 2 tests for |
Note that e.g. It's probably a good idea to have more tests for that, but to test the behaviour exhibited here I'd have to involve both a scheduler and merge, plus something like repeat... it feels a bit weird testing for referential transparency :) |
lgtm. I don't think so we need tests for that a such it was more like escaping the ref transparency bounds. |
let me reformat real quick |
Anything involving
unconsAsync
(e.g.merge
,interruptWith
) was affected, and the side-effecting behaviour resulted in weird things happening. As an example:all the
broken
except the first would complete immediately.I would have liked to add a test for this, but struggling for ideas to make it nice