[core libraries] Rename NonEmpty.groupWith/sortWIth to *On*

Philip Hazelden philip.hazelden at gmail.com
Mon Feb 17 22:39:54 UTC 2020


(Sending again with reply all...)

On Mon, Feb 17, 2020 at 1:00 PM Andrew Martin <andrew.thaddeus at gmail.com>
wrote:
> Here is the documentation for Generalized List Comprehensions that
mentions sortWith:
https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html#generalised-sql-like-list-comprehensions

Yes, it mentions sortWith and groupWith. But these functions only seem to
be used explicitly, by name. The rationale given for the *With names in
NonEmpty was that using that extension and RebindableSyntax, the names
could be used implicitly. In that case it would be more awkward to use
functions named sortOn or groupOn. But as far as I can tell, that doesn't
happen. (I assume it either did at the time, or was expected to in the near
future.)

> The asymmetry between Data.List and Data.List.NonEmpty is unfortunate. I
think my preference would be a non-breaking change where groupOn is added
to Data.List.NonEmpty effectively as an alias for groupWith and they would
both stay forever. I've not looked at the semantic difference between
sortWith and sortOn, so I'm not sure which of those should be implemented
with the other, but ideally, I would like to see both of them there.

I do think adding the new names and not removing the others would be an
improvement on the status quo, though it's not my preference.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200217/33d2b53c/attachment.html>


More information about the Libraries mailing list