Quantcast

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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Ömer Sinan Ağacan
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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Artyom Kazak-2
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
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Loading...