[GHC] #12044: Remove sortWith in favor of sortOn

GHC ghc-devs at haskell.org
Mon Oct 17 23:02:15 UTC 2016


#12044: Remove sortWith in favor of sortOn
-------------------------------------+-------------------------------------
        Reporter:  cblp              |                Owner:  cblp
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  7.10.3
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #2659             |  Differential Rev(s):  Phab:D2587
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 > Somebody should investigate and document when one should use `sortOn` or
 `sortWith`.

 In general if the mapping function is expensive to compute then you should
 probably be using `sortOn`, as it only needs to compute it once for each
 element. `sortWith`, on the other hand must compute the mapping function
 for every comparison that it performs. Beyond that general intuition it's
 hard to give any specific prescription.

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


More information about the ghc-tickets mailing list