-
Notifications
You must be signed in to change notification settings - Fork 102
Document the behavior of fromListWith with non-associative and non-commutative operations #237
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
Document the behavior of fromListWith with non-associative and non-commutative operations #237
Conversation
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.
Cheers! This is very valuable documentation!
My suggestions below are optional, since this is already a large improvement on the status quo.
BTW, CI has been fixed in the meantime, so a rebase should take care of the red status here. |
3c91418
to
37ea567
Compare
Thanks for the reviews :) |
d88aaa6
to
54499b4
Compare
I made the two existing examples more concrete. The last one is tricky to improve because it would be best illustrated with a non-associative operation, and a good instance is hard to come by. |
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, that's a great concrete example! :)
I think that the "gotcha" documented here is a bit too important to be hidden within the collapsible Examples
section though. You could add a second heading to end the collapsible section, or alternatively just remove the collapsible section heading.
Apologies for the endless bikeshedding BTW! ;)
…mmutative operations Also: - Copy the improvements of haskell-unordered-containers#133 from Strict to Lazy - Make the examples more concrete
54499b4
to
b6e5c31
Compare
Fair enough! |
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 again, @Lysxia! :)
Also copy the improvements of #133 from Strict to Lazy.
On top of
f newVal oldVal
, we also need to explain that the elements are accumulated left-to-right. The fact thatfromListWith (++)
gives the elements in reverse order seems somewhat counter-intuitive to me, but it is what it is.