From 9a6c84410d4678c80753d9ff3983a2fa31a5813b Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 18 Apr 2014 16:17:46 +0900 Subject: [PATCH] close import. --- Language/Haskell/GhcMod/GhcPkg.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Language/Haskell/GhcMod/GhcPkg.hs b/Language/Haskell/GhcMod/GhcPkg.hs index a50c202..cb790be 100644 --- a/Language/Haskell/GhcMod/GhcPkg.hs +++ b/Language/Haskell/GhcMod/GhcPkg.hs @@ -21,7 +21,8 @@ import Language.Haskell.GhcMod.Types import Language.Haskell.GhcMod.Utils import System.FilePath (()) import System.Process (readProcess) -import Text.ParserCombinators.ReadP +import Text.ParserCombinators.ReadP (ReadP, char, between, sepBy1, many1, string, choice, eof) +import qualified Text.ParserCombinators.ReadP as P ghcVersion :: Int ghcVersion = read cProjectVersionInt @@ -81,7 +82,7 @@ parseGhcPkgOutput (l:ls) = packageLine :: String -> Maybe Package packageLine l = - case listToMaybe $ readP_to_S packageLineP l of + case listToMaybe $ P.readP_to_S packageLineP l of Just ((Normal,p),_) -> Just p Just ((Hidden,p),_) -> Just p _ -> Nothing @@ -90,7 +91,7 @@ data PackageState = Normal | Hidden | Broken deriving (Eq,Show) packageLineP :: ReadP (PackageState, Package) packageLineP = do - skipSpaces + P.skipSpaces p <- choice [ (Hidden,) <$> between (char '(') (char ')') packageP , (Broken,) <$> between (char '{') (char '}') packageP , (Normal,) <$> packageP ] @@ -100,7 +101,7 @@ packageLineP = do packageP :: ReadP (PackageBaseName, PackageVersion, PackageId) packageP = do pkgSpec@(name,ver) <- packageSpecP - skipSpaces + P.skipSpaces i <- between (char '(') (char ')') $ packageIdSpecP pkgSpec return (name,ver,i) @@ -112,11 +113,11 @@ packageSpecP = do packageIdSpecP :: (PackageBaseName,PackageVersion) -> ReadP PackageId packageIdSpecP (name,ver) = do string name >> char '-' >> string ver >> char '-' >> return () - many1 (satisfy isAlphaNum) + many1 (P.satisfy isAlphaNum) packageCompCharP :: ReadP Char packageCompCharP = - satisfy $ \c -> isAlphaNum c || c `elem` "_-." + P.satisfy $ \c -> isAlphaNum c || c `elem` "_-." -- | Get options needed to add a list of package dbs to ghc-pkg's db stack ghcPkgDbStackOpts :: [GhcPkgDb] -- ^ Package db stack