-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
traverse
behavior with v2.11.0
#4661
Comments
For the context, we found the difference after I upgraded fs2 to 3.11.0 from 3.10.2 The dependency relationships to cats-core are
|
@ken1ma , the code inside
Since var wc = WriteCursor(0) // I was too lazy to rewrite traverse to foldLeft and eliminate var
val run =
List(2, 3).traverse: len =>
for
prevWc <- IO.delay { wc }
nextWc <- prevWc.write(len)
_ <- IO.delay { println(s"offset: (${prevWc.offset}, $len) -> ${nextWc.offset}") }
_ <- IO.delay { wc = nextWc }
yield ()
.void Otherwise, But I would suggest to switch to Also, a minor hint – in this example you could make use of |
... and yeah, I would argue with ChatGPT – it is not related to "potentially parallel evaluation of accG and f(a)", actually. |
Thank you for the comment.
I should have known. |
@satorg Thank you again for the reply.
In a less-reduced code, I can still see the problem of not suspending the read of
Yes. We are now now using
Yes. We are waiting for |
traverse
started to work differently for us with cats 2.11.0.I'd appreciate if someone can tell me whether this is expected or not.
A reduced code to reproduce the difference (scala-cli version)
If we change the dependency to cats-core 2.10.0, it prints
but with cats-core 2.11.0 and 2.12.0 (as in the above code)
The the previous behavior is restored if Use applicative methods instead of flatMap is reverted, by changing the code in
Traverse.traverseDirectly
to
IO
is used in this, so I think the order of evaluations byTraverse
should be deterministic.The text was updated successfully, but these errors were encountered: