File tree 2 files changed +7
-15
lines changed
2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ main = do
21
21
mode <- getMode
22
22
if modeTest mode then test else do
23
23
settings <- readSettings $ modeHints mode
24
- let ignore idea = let f = classify settings in f idea == Skip
25
- let hints = readHints settings
26
-
27
- ideas <- liftM concat $ mapM (runFile ignore hints) (modeFiles mode)
24
+ let apply = map ( classify settings) . applyHint (readHints settings)
25
+ ideas <- liftM concat $ mapM (liftM apply . parseFile) (modeFiles mode)
26
+ mapM_ print ideas
27
+
28
28
let n = length ideas
29
29
if n == 0 then do
30
30
when (not $ null $ modeReports mode) $ putStrLn " Skipping writing reports"
@@ -34,11 +34,3 @@ main = do
34
34
putStrLn $ " Writing report to " ++ x ++ " ..."
35
35
writeReport x ideas
36
36
putStrLn $ " Found " ++ show n ++ " suggestions"
37
-
38
-
39
- runFile :: (Idea -> Bool ) -> Hint -> FilePath -> IO [Idea ]
40
- runFile ignore hint file = do
41
- src <- parseFile file
42
- let ideas = filter (not . ignore) $ applyHint hint src
43
- mapM_ print ideas
44
- return ideas
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ pickFiles = mapM parseFile
30
30
31
31
32
32
-- Eta bound variable lifted so the filter only happens once per classify
33
- classify :: [Setting ] -> Idea -> Rank
34
- classify xs = \ i -> foldl'
33
+ classify :: [Setting ] -> Idea -> Idea
34
+ classify xs = \ i -> i{rank = foldl'
35
35
(\ r c -> if matchHint (hint c) (hint i) && matchFunc (func c) (func i) then rank c else r)
36
- Warn xs2
36
+ (rank i) xs2}
37
37
where
38
38
xs2 = filter isClassify xs
39
39
You can’t perform that action at this time.
0 commit comments