X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;h=e5f702355244f20521c63c1ddbb27f84aba924d6;hb=fa6c4bf01427a4191a595afecf90d96b27bad306;hp=495df8257fe0af8d175c21687549f52e272d7e81;hpb=41b4b210247d5cf13952d4e115fc4d6b58eef234;p=ghc-hetmet.git diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 495df82..e5f7023 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -26,7 +26,7 @@ module Util ( nTimes, -- sorting - sortLe, sortWith, + sortLe, sortWith, on, -- transitive closures transitiveClosure, @@ -457,6 +457,10 @@ sortWith :: Ord b => (a->b) -> [a] -> [a] sortWith get_key xs = sortLe le xs where x `le` y = get_key x < get_key y + +on :: (a -> a -> Ordering) -> (b -> a) -> b -> b -> Ordering +on cmp sel = \x y -> sel x `cmp` sel y + \end{code} %************************************************************************