From 0c76a801f6195c57e8a74f40e4385845e7c6982a Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 28 Mar 2014 13:53:58 +0900 Subject: [PATCH] hlint hack. --- src/GHCModi.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/GHCModi.hs b/src/GHCModi.hs index 85022c3..bdbd11e 100644 --- a/src/GHCModi.hs +++ b/src/GHCModi.hs @@ -32,6 +32,7 @@ import qualified Data.Map.Strict as M import Data.Map (Map) import qualified Data.Map as M #endif +import Data.Maybe (fromMaybe) import Data.Set (Set) import qualified Data.Set as S import qualified Exception as GE @@ -93,7 +94,7 @@ setupDB cradle mlibdir opt mvar = E.handle handler $ do loop :: Set FilePath -> LineSeparator -> MVar DB -> Logger -> Ghc () loop set ls mvar readLog = do - cmdArg <- liftIO $ getLine + cmdArg <- liftIO getLine let (cmd,arg') = break (== ' ') cmdArg arg = dropWhile (== ' ') arg' (msgs,ok,set') <- case cmd of @@ -119,7 +120,7 @@ checkStx set ls readLog file = do mdel <- removeMainTarget when add $ addTargetFiles [file] void $ G.load LoadAllTargets - msgs <- liftIO $ readLog + msgs <- liftIO readLog let set1 = if add then S.insert file set else set set2 = case mdel of Nothing -> set1 @@ -148,9 +149,7 @@ findSym :: Set FilePath -> MVar DB -> String -> Ghc ([String], Bool, Set FilePath) findSym set mvar sym = do db <- liftIO $ readMVar mvar - let ret = case M.lookup sym db of - Nothing -> [] - Just xs -> xs + let ret = fromMaybe [] (M.lookup sym db) return (ret, True, set) lintStx :: Set FilePath -> LineSeparator -> FilePath