projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merge up to ghc HEAD 16-Apr-2011
[ghc-hetmet.git]
/
distrib
/
compare
/
Utils.hs
diff --git
a/distrib/compare/Utils.hs
b/distrib/compare/Utils.hs
index
58298c1
..
e2da6b5
100644
(file)
--- a/
distrib/compare/Utils.hs
+++ b/
distrib/compare/Utils.hs
@@
-1,6
+1,8
@@
module Utils where
module Utils where
+import Data.Function
+import Data.List
import System.Exit
import System.IO
import Text.Regex.Posix
import System.Exit
import System.IO
import Text.Regex.Posix
@@
-26,3
+28,13
@@
re r str = case matchM r' str :: Maybe (String, String, String, [String]) of
Nothing -> Nothing
where r' = makeRegex r :: Regex
Nothing -> Nothing
where r' = makeRegex r :: Regex
+unSepList :: Eq a => a -> [a] -> [[a]]
+unSepList x xs = case break (x ==) xs of
+ (this, _ : xs') ->
+ this : unSepList x xs'
+ (this, []) ->
+ [this]
+
+sortByFst :: Ord a => [(a, b)] -> [(a, b)]
+sortByFst = sortBy (compare `on` fst)
+