Repository navigation
[breaking] Switch union to be right-biased - #4
fehrenbach wants to merge 2 commits into
Conversation
|
I'm still in favour of doing this, it's just a breaking change that will spread really far so will probably wait until we have a couple of other breaking core library changes. |
|
Ah, sorry. I was going through stuff and was feeling less enthusiastic. It's a subtle breaking change that is not visible in the type and the benefit is marginal. I'll reopen. |
|
No problem! Sorry it was just left sitting here with no comment even. |
|
@garyb Do you plan to merge this PR or do you consider take the more flexible approach suggested by @LiamGoodacre: |
|
I'm happy to talk about it, that version definitely has some nice properties, but in practice I've very rarely wanted that style of union - It is pretty easy to get either behaviour specifically via |
From this PR it seems that it is really hard to say what is desired style of union. Instance based on value
I don't think it is better than defining instance based on value
|
The benefit I see is that it would avoid weird unexpected behaviour (when under the assumption it's For what it's worth, Haskell uses
|
|
I would suggest introducing |
|
I’m sorry that I didn’t raise this sooner, but I’m actually not at all keen on this. This is almost certainly going to break lots of downstream code in a way that’s only visible at runtime. Also, I feel like right bias for these kinds of functions is generally pretty uncommon anyway. Are we using right bias anywhere else in the core libraries? |
|
@hdgarrood @garyb should I open another issue related to possible |
|
I'm not sure a new issue is necessary, since we already have this thread and #2. My vote would be to leave everything as it is, though. I don't see a way of changing this instance to any of the suggested alternatives which won't break a lot of code. At the very least I think we would need to get community approval for this proposal on Discourse. |
|
@hdgarrood Cool. Thanks for quick response! |
|
Thanks for the PR, but I think at this stage it’s fairly clear that this isn’t going to happen (cf https://discourse.purescript.org/t/unbiasing-the-semigroup-instance-for-map/1935) - there appears to be a fairly strong consensus that |
On top of #3.
This is a breaking change!
Closes #2.