From dcfaa9355e57517c5de14445bb6628f5d11a6255 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Mon, 2 May 2016 06:03:26 -0400 Subject: [PATCH] Refactor in preparation for progress bar --- app/Main.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Main.hs b/app/Main.hs index 1eb36bc..b844d17 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -8,7 +8,7 @@ import Unused.Types main :: IO () main = do terms <- pure . lines =<< getContents - results <- pure . concat =<< mapM search terms + results <- executeSearch terms let response = parseLines $ unlines results case withOneOccurrence $ withOneFile response of @@ -19,6 +19,11 @@ main = do return () +executeSearch :: [String] -> IO [String] +executeSearch terms = do + results <- mapM search terms + return $ concat results + printMatchPair :: (String, [TermMatch]) -> IO () printMatchPair (term', matches) = do setSGR [SetColor Foreground Vivid Red]