Proposal: rename Data.List.NonEmpty.sortWith to sortOn for consistency

Artyom yom at
Thu May 18 16:32:14 UTC 2017

sortWith and sortOn have different implementations (specifically, they
make a different tradeoff regarding performance – sortWith is faster for
cheap functions, sortOn is faster for expensive functions).

I'm +1 on adding sortOn, −1 on renaming sortWith to sortOn (as it would
be very confusing to have a Data.List.NonEmpty.sortOn that doesn't match
Data.List.sortOn), and −0.1 on removing sortWith.

On 05/18/2017 07:21 PM, Ömer Sinan Ağacan wrote:
> Proposal: Introduce `Data.List.NonEmpty.sortOn` for
> `Data.List.NonEmpty.sortWith` and deprecate `sortWith`.
> Motivation: Data.List.NonEmpty API is very similar to Data.List, except this
> same function is called `sortOn` in `Data.List`. I think for consistency it'd
> good to rename `sortWith` to `sortOn`.
> Why not rename `sortOn` to `sortWith`? I think `Data.List` is much more widely
> used than `Data.List.NonEmpty`, so renaming `sortWith` would lead to much less
> deprecation warnings.
> Ömer
> _______________________________________________
> Libraries mailing list
> Libraries at

More information about the Libraries mailing list