[GHC] #9337: Add `sortOn` function to Data.List

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: JohnWiegley | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: 7.8.3 Keywords: | Differential Revisions: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: | Difficulty: Easy (less Blocking: | than 1 hour) | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- This passed the vote on the libraries list a while ago, but I forget to add a ticket. The request was to add `sortOn` to `Data.List`: {{{ -- | Sort a list using a key on each element. This implements the -- decorate-sort-undecorate paradigm, also called a Schwarzian transform. sortOn :: Ord b => (a -> b) -> [a] -> [a] sortOn f = map snd . sortBy (comparing fst) . map (\x -> (f x, x)) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: | Owner: JohnWiegley | Status: new Type: feature | Milestone: 7.10.1 request | Version: 7.8.3 Priority: normal | Keywords: Component: | Operating System: Unknown/Multiple libraries/base | Type of failure: None/Unknown Resolution: | Test Case: Differential Revisions: | Blocking: Architecture: | Unknown/Multiple | Difficulty: Easy (less | than 1 hour) | Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by ekmett): It is "Schwartzian". ;) Otherwise, this passed the libraries process easily and folks on the committee who were asked about it were all in favor, so it looks good to me. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: | Owner: JohnWiegley | Status: new Type: feature | Milestone: 7.10.1 request | Version: 7.8.3 Priority: normal | Keywords: Component: | Operating System: Unknown/Multiple libraries/base | Type of failure: None/Unknown Resolution: | Test Case: Differential Revisions: | Blocking: Architecture: | Unknown/Multiple | Difficulty: Easy (less | than 1 hour) | Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by JohnWiegley): Ack, my German teacher just rolled in her grave. Thanks for catching that. :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: | Owner: JohnWiegley | Status: new Type: feature | Milestone: 7.10.1 request | Version: 7.8.3 Priority: normal | Keywords: Component: | Operating System: Unknown/Multiple libraries/base | Type of failure: None/Unknown Resolution: | Test Case: Differential Revisions: | Blocking: Architecture: | Unknown/Multiple | Difficulty: Easy (less | than 1 hour) | Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by hvr): I'd like to push this to base, whom shall I declare as being the author? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: | Owner: JohnWiegley | Status: new Type: feature | Milestone: 7.10.1 request | Version: 7.8.3 Priority: normal | Keywords: Component: | Operating System: Unknown/Multiple libraries/base | Type of failure: None/Unknown Resolution: | Test Case: Differential Revisions: | Blocking: Architecture: | Unknown/Multiple | Difficulty: Easy (less | than 1 hour) | Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by hvr): wait a minute... why did you resubmit this? wasn't this already handled by #9004? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------------+------------------------------- Reporter: JohnWiegley | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: 7.8.3 Resolution: | Keywords: Differential: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 hour) | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: -------------------------------------------+------------------------------- Comment (by JohnWiegley): hvr, you're right, this is a duplicate. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------------+------------------------------- Reporter: JohnWiegley | Owner: Type: feature request | Status: closed Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: 7.8.3 Resolution: duplicate | Keywords: Differential: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 hour) | Type of failure: Blocked By: | None/Unknown Related Tickets: #9004 | Test Case: | Blocking: -------------------------------------------+------------------------------- Changes (by hvr): * status: new => closed * resolution: => duplicate * related: => #9004 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: JohnWiegley | Owner: Type: feature request | Status: closed Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: 7.8.3 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9004 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by JohnWiegley): This is also a dupe of part of #2659, which was closed 5 years ago now as wontfix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9337: Add `sortOn` function to Data.List -------------------------------------+------------------------------------- Reporter: JohnWiegley | Owner: Type: feature request | Status: closed Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: 7.8.3 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9004, #2659 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ekmett): * related: #9004 => #9004, #2659 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9337#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC