Function to add to Data.List

Jake McArthur jake.mcarthur at gmail.com
Sun Apr 6 12:05:36 UTC 2014


I've always called my local definitions of this function `sortOn`. I also
frequently define `groupOn`.

I dislike the suggestion to use rewrite rules. It's not always an
optimization to memoize the key to sort on. For example, `sortOn id` is
probably slower than `sortBy (comparing id)`. Also, if the key is very
large, it could be a pretty bad regression.

On Sun, Apr 6, 2014 at 6:48 AM, Daniel Trstenjak <daniel.trstenjak at gmail.com
> wrote:

> Hi John,
>
> I only somehow dislike the name 'sortByKey', because 'Key' feels
> a bit generic, without giving that much of a hint, perhaps something
> like 'sortMapped' could be a bit more telling.
>
> Greetings,
> Daniel
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140406/6ca5de0b/attachment.html>


More information about the Libraries mailing list