ref: aeae7c4f920038bfc9474560d7956505d1710fa7
parent: a10da947fe182bb14b8e2e14609fdf923edaeb9a
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Mon Dec 4 13:26:53 EST 2023
Add sortBy
--- a/lib/Data/List.hs
+++ b/lib/Data/List.hs
@@ -351,6 +351,9 @@
sort :: forall a . Ord a => [a] -> [a]
sort = sortLE (<=)
+sortBy :: forall a . (a -> a -> Ordering) -> [a] -> [a]
+sortBy f = sortLE (\ x y -> f x y /= GT)
+
-- A simple "quicksort" for now.
sortLE :: forall a . (a -> a -> Bool) -> [a] -> [a]
sortLE _ [] = []
--
⑨