[project @ 2005-01-28 12:55:17 by simonmar]
[ghc-hetmet.git] / ghc / compiler / utils / Util.lhs
index 6d2be04..11d1b5e 100644 (file)
@@ -21,7 +21,7 @@ module Util (
        nTimes,
 
        -- sorting
-       sortLe,
+       sortLe, sortWith,
 
        -- transitive closures
        transitiveClosure,
@@ -53,7 +53,6 @@ module Util (
        readRational,
     ) where
 
-#include "../includes/ghcconfig.h"
 #include "HsVersions.h"
 
 import Panic           ( panic, trace )
@@ -426,6 +425,11 @@ mergeSortLe le = generalMergeSort le
 
 sortLe :: (a->a->Bool) -> [a] -> [a]
 sortLe le = generalNaturalMergeSort le
+
+sortWith :: Ord b => (a->b) -> [a] -> [a]
+sortWith get_key xs = sortLe le xs
+  where
+    x `le` y = get_key x < get_key y   
 \end{code}
 
 %************************************************************************