projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove some code only used with GHC 6.11.*
[ghc-hetmet.git]
/
utils
/
testremove
/
checkremove.hs
diff --git
a/utils/testremove/checkremove.hs
b/utils/testremove/checkremove.hs
index
5a948b8
..
5474512
100644
(file)
--- a/
utils/testremove/checkremove.hs
+++ b/
utils/testremove/checkremove.hs
@@
-3,6
+3,8
@@
module Main (main) where
import Control.Monad
import Data.List
import Control.Monad
import Data.List
+import qualified Data.Set as Set
+import Data.Set (Set)
import System.Environment
import System.Exit
import System.FilePath
import System.Environment
import System.Exit
import System.FilePath
@@
-20,20
+22,23
@@
main = do args <- getArgs
_ ->
error "Bad args"
_ ->
error "Bad args"
+readSet :: FilePath -> IO (Set FilePath)
+readSet fp = liftM (Set.fromList . lines) $ readFile fp
+
doit :: FilePath -> FilePath -> FilePath -> IO ()
doit contentsBeforeFile contentsAfterFile wouldBeCleanedFile
doit :: FilePath -> FilePath -> FilePath -> IO ()
doit contentsBeforeFile contentsAfterFile wouldBeCleanedFile
- = do contentsBefore <- liftM lines $ readFile contentsBeforeFile
- contentsAfter <- liftM lines $ readFile contentsAfterFile
+ = do contentsBefore <- readSet contentsBeforeFile
+ contentsAfter <- readSet contentsAfterFile
wouldBeCleaned <- liftM (map read . lines) $ readFile wouldBeCleanedFile
wouldBeCleaned <- liftM (map read . lines) $ readFile wouldBeCleanedFile
- let newContentsAfter = contentsAfter \\ contentsBefore
+ let newContentsAfter = contentsAfter `Set.difference` contentsBefore
let cleanedAfter = simulateCleans newContentsAfter wouldBeCleaned
let cleanedAfter = simulateCleans newContentsAfter wouldBeCleaned
- unless (null cleanedAfter) $ do
+ unless (Set.null cleanedAfter) $ do
hPutStrLn stderr "Files not cleaned:"
hPutStrLn stderr "Files not cleaned:"
- mapM_ (hPutStrLn stderr . show) cleanedAfter
+ mapM_ (hPutStrLn stderr . show) (Set.toList cleanedAfter)
exitWith (ExitFailure 1)
exitWith (ExitFailure 1)
-simulateCleans :: [FilePath] -> [CleanWhat] -> [FilePath]
-simulateCleans fs cws = filter (not . cleaned) fs
+simulateCleans :: Set FilePath -> [CleanWhat] -> Set FilePath
+simulateCleans fs cws = Set.filter (not . cleaned) fs
where cleaned f = any (`willClean` f) cws
willClean :: CleanWhat -> FilePath -> Bool
where cleaned f = any (`willClean` f) cws
willClean :: CleanWhat -> FilePath -> Bool