Skip to content

"implementation is left-biased" - but fromList(With) is not #333

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

Open
jwaldmann opened this issue Sep 4, 2016 · 2 comments
Open

"implementation is left-biased" - but fromList(With) is not #333

jwaldmann opened this issue Sep 4, 2016 · 2 comments

Comments

@jwaldmann
Copy link
Contributor

jwaldmann commented Sep 4, 2016

The actual behaviour of fromListWith surprised me, given the general "left-biased" feeling of the library.
I think I was expecting that these be equivalent

fromListWith (++) [ (0,"foo"), (1,"bar"), (0,"oof") ]
unionsWith (++) [ singleton 0 "foo", singleton 1 "bar", singleton 0 "oof" ]

but they are not. Perhaps add a warning in the documentation of fromListWith? Currently, you have to parse the example to infer the semantics.

@jwaldmann jwaldmann changed the title "implementation is left-biased" - but fromList is not "implementation is left-biased" - but fromList(With) is not Sep 4, 2016
@treeowl
Copy link
Contributor

treeowl commented Sep 4, 2016

Yes, this trips me up too. The idea is that it does a left fold with
insert, which indeed is unexpected. Feel free to open a PR, or I'll try to
fix it myself.

On Sep 4, 2016 5:32 AM, "jwaldmann" [email protected] wrote:

The actual behaviour of fromList surprised me, given the general
"left-biased" feeling of the library.
I think I was expecting that these be equivalent

fromListWith (++) [ (0,"foo"), (1,"bar"), (0,"oof") ]
unionsWith (++) [ singleton 0 "foo", singleton 1 "bar", singleton 0 "oof" ]

but they are not. Perhaps add a warning in the documentation of fromListWith?
Currently, you have to parse the example to infer the semantics.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#333, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABzi_R9-ewnRWJDxUaBBNkj0KYVn_RwIks5qmpBFgaJpZM4J0fuU
.

@sjakobi
Copy link
Member

sjakobi commented Jul 15, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants