Fixes issue #912: Executes liftF effect twice in a product composition#914
Conversation
|
@AntonioMateoGomez @fedefernandez Could someone from the maintainers please take a look when you have a moment? |
sloshy
left a comment
There was a problem hiding this comment.
Spent some time trying to see if this was representative of a behavior regression by running your tests on older releases from 5+ years ago, but no, I believe that this behavior was just never tested for before. Good find, and I'll double-check with some other Xebia people to see if they concur but I believe this can and should be merged.
|
@Lost-Fly if you can run |
32c1b79 to
2b34a93
Compare
|
@sloshy I`ve done scalafmt on tests, check it please |
|
Currently waiting on #915 and then this can be updated with main, and should be good to go after that. |
|
@Lost-Fly seems like it'll work again once you update the branch from main. I'd do it but then it'd associate me with the commit, and I believe that would mean I'd need someone else to review it. |
…oduct composition When combining a Done fetch with a Blocked fetch in product/productR/map2, the previous implementation would call product(fa, c) or map2(fa, c)(f), causing the already-completed effect `fa` to be re-run. The fix uses the already-computed result value instead of re-running the entire fetch: - product: use c.map((a, _)) instead of product(fa, c) - productR: use c or c.as(b) instead of productR(fa)(c) - map2: use c.map(b => f(a, b)) instead of map2(fa, c)(f) Added unit tests to verify that side effects are executed exactly once.
2b34a93 to
815dcb0
Compare
|
I've done rebase onto main. Please run the tests now |
Fixes issue #912
When combining a Done fetch with a Blocked fetch in product/productR/map2, the previous implementation would call product(fa, c) or map2(fa, c)(f), causing the already-completed effect
fato be re-run.The fix uses the already-computed result value instead of re-running the entire fetch:
Added unit tests to verify that side effects are executed exactly once.