ref: 342c800869083b1419676b84868021d7c5651937
parent: d1ba43e7b66c50a3289cf9c440b964e620d365f6
author: Lennart Augustsson <lennart@augustsson.net>
date: Sat Sep 16 19:45:28 EDT 2023
A little more efficient
--- a/lib/Data/List.hs
+++ b/lib/Data/List.hs
@@ -277,8 +277,9 @@
-- A simple "quicksort" for now.
sortLE :: forall a . (a -> a -> Bool) -> [a] -> [a]
sortLE _ [] = []
-sortLE le (x:xs) = sortLE le lt ++ (x : sortLE le ge)
- where (ge, lt) = partition (le x) xs
+sortLE le (x:xs) =
+ case partition (le x) xs of
+ (ge, lt) -> sortLE le lt ++ (x : sortLE le ge)
mapMaybe :: forall a b . (a -> Maybe b) -> [a] -> [b]
mapMaybe _ [] = []
--
⑨