[GHC] #2659: Add sortOn and other *On functions

GHC ghc-devs at haskell.org
Sat Apr 19 09:52:05 UTC 2014


#2659: Add sortOn and other *On functions
-------------------------------------+---------------------------------
        Reporter:  twanvl            |         Owner:
            Type:  proposal          |        Status:  closed
        Priority:  normal            |     Milestone:  Not GHC
       Component:  libraries/base    |       Version:  6.9
      Resolution:  wontfix           |      Keywords:
Operating System:  Unknown/Multiple  |  Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |    Difficulty:  Unknown
       Test Case:                    |
-------------------------------------+---------------------------------

Comment (by Herbert Valerio Riedel <hvr@…>):

 In [changeset:"44512e3c855d8fb36ab6580f4f97f842ebcf4c6c/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="44512e3c855d8fb36ab6580f4f97f842ebcf4c6c"
 Add Data.List.sortOn function (re #9004 and #2659)

 `sortOn` sorts a list by comparing the results of a key function applied
 to each
 element.  `sortOn f` is equivalent to `sortBy . comparing f`, but has the
 performance advantage of only evaluating `f` once for each element in the
 input list.

 Historical note: This was already proposed in 2008 as part of

   http://www.haskell.org/pipermail/libraries/2008-October/010797.html

 It was, however, the recent re-attempt

   http://www.haskell.org/pipermail/libraries/2014-April/022489.html

 that let `sortOn` make it into base at last. Maybe the other functions
 mentioned in #2659 might be worth reconsidering as well.
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2659#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list