X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Futils%2FUtil.lhs;h=11d1b5e545700e1552773d0870de7ecd96aa603c;hb=bb6074550e0e7fadfd6a9d4b00e1230fa5af6f70;hp=6d2be048bea24841976d8bb2b7a2de3e4edb67c0;hpb=c45a0ac5fdc6a931c3bc1a45fd4967f54c2983ca;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/Util.lhs b/ghc/compiler/utils/Util.lhs index 6d2be04..11d1b5e 100644 --- a/ghc/compiler/utils/Util.lhs +++ b/ghc/compiler/utils/Util.lhs @@ -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} %************************************************************************