From 426917fc4412c925217ec205a201e48daa5740d2 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Thu, 27 Mar 2014 15:21:18 +0900 Subject: [PATCH] close import. --- Language/Haskell/GhcMod/Check.hs | 8 ++++---- Language/Haskell/GhcMod/Cradle.hs | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Language/Haskell/GhcMod/Check.hs b/Language/Haskell/GhcMod/Check.hs index 08581eb..a619259 100644 --- a/Language/Haskell/GhcMod/Check.hs +++ b/Language/Haskell/GhcMod/Check.hs @@ -3,8 +3,8 @@ module Language.Haskell.GhcMod.Check (checkSyntax, check) where import Control.Applicative ((<$>)) import Control.Monad (void) import CoreMonad (liftIO) -import Exception -import GHC +import GHC (Ghc, LoadHowMuch(LoadAllTargets)) +import qualified GHC as G import Language.Haskell.GhcMod.ErrMsg import Language.Haskell.GhcMod.GHCApi import Language.Haskell.GhcMod.Types @@ -33,12 +33,12 @@ check :: Options -> [FilePath] -- ^ The target files. -> Ghc [String] check _ _ [] = error "ghc-mod: check: No files given" -check opt cradle fileNames = checkIt `gcatch` handleErrMsg ls +check opt cradle fileNames = checkIt `G.gcatch` handleErrMsg ls where checkIt = do (readLog,_) <- initializeFlagsWithCradle opt cradle options True setTargetFiles fileNames - void $ load LoadAllTargets + void $ G.load LoadAllTargets liftIO readLog options | expandSplice opt = "-w:" : ghcOpts opt diff --git a/Language/Haskell/GhcMod/Cradle.hs b/Language/Haskell/GhcMod/Cradle.hs index 269fe26..e230c29 100644 --- a/Language/Haskell/GhcMod/Cradle.hs +++ b/Language/Haskell/GhcMod/Cradle.hs @@ -7,10 +7,11 @@ module Language.Haskell.GhcMod.Cradle ( , getPackageDbPackages ) where -import Data.Char (isSpace) import Control.Applicative ((<$>)) -import Control.Exception as E (catch, throwIO, SomeException) +import Control.Exception (SomeException(..)) +import qualified Control.Exception as E import Control.Monad (filterM) +import Data.Char (isSpace) import Data.List (isPrefixOf, isSuffixOf, tails) import Language.Haskell.GhcMod.Types import System.Directory (getCurrentDirectory, getDirectoryContents, doesFileExist) @@ -70,7 +71,7 @@ cabalDir :: FilePath -> IO (FilePath,FilePath) cabalDir dir = do cnts <- getCabalFiles dir case cnts of - [] | dir' == dir -> throwIO $ userError "cabal files not found" + [] | dir' == dir -> E.throwIO $ userError "cabal files not found" | otherwise -> cabalDir dir' cfile:_ -> return (dir,dir cfile) where