close import.

This commit is contained in:
Kazu Yamamoto 2014-03-27 15:21:18 +09:00
parent 0a323f71b9
commit 426917fc44
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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