-
-
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
add unordered parallel variants of (flat)traverse and (flat)sequence #2946
add unordered parallel variants of (flat)traverse and (flat)sequence #2946
Conversation
OK, somebody beat me to it: #2931 Too bad I didn't notice that earlier. But hey, you probably really want those |
Codecov Report
@@ Coverage Diff @@
## master #2946 +/- ##
==========================================
- Coverage 93.99% 93.84% -0.15%
==========================================
Files 369 369
Lines 7056 7067 +11
Branches 179 195 +16
==========================================
Hits 6632 6632
- Misses 424 435 +11
Continue to review full report at Codecov.
|
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.
Sorry for the wait, this looks great :)
Can we add some tests to the SyntaxSuite
to ensure these resolve properly?
Hey @LukaJCB, I've added some tests now. Thanks for the idea, it actually helped me shake out some silly mistakes in the implementation. |
I've also removed |
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.
Thanks, this looks great!
Hi,
There currently doesn't seem to be a convenient way to traverse a
Set
withIO
.traverse
doesn't work because there's noTraverse
instance forSet
, andunorderedTraverse
doesn't work because there is noCommutativeApplicative
instance forIO
. So I've addedparUnorderedTraverse
andparUnorderedSequence
for that purpose.I also added
parUnorderedFlatTraverse
andparUnorderedFlatSequence
for symmetry, but given that the non-par versions of these don't exist I'm not really sure we need these.Another logical set of operations would be
parUnorderedTraverse_
andparUnorderedSequence_
. But again, there is nounorderedTraverse_
orunorderedSequence_
inUnorderedFoldable
, so it's not going to be any more efficient than the non-_ variants, and given that it's easy to just discard the return value I haven't added them.So overall I think that
parUnorderedTraverse
andparUnorderedSequence
should be pretty uncontroversial. Which of the other ones do you think we want? I think they all make sense for symmetry, but then I'm not sure how useful they are in practice.Oh, and one more question: is
FlatMap
actually the right typeclass to use for theflat
variants, or should it beCommutativeFlatMap
?