[Haskell-cafe] A small oversight
lemming at henning-thielemann.de
Mon Feb 22 13:53:06 EST 2010
On Sun, 21 Feb 2010, Leon Smith wrote:
> On Sat, Feb 20, 2010 at 5:47 AM, Andrew Coppin
> <andrewcoppin at btinternet.com> wrote:
>> sortOn :: (Ord y) => (x -> y) -> [x] -> [x]
>> sortOn foo = sortBy (compare `on` foo)
> Incidentally, this function is provided as Data.List.Ordered.sortOn'
> in the data-ordlist package...
Or Key.sort in utility-ht which caches the keys to be sorted.
Useful if the function is not just a record selector.
More information about the Haskell-Cafe