close import.
This commit is contained in:
parent
0a323f71b9
commit
426917fc44
@ -3,8 +3,8 @@ module Language.Haskell.GhcMod.Check (checkSyntax, check) where
|
|||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
import CoreMonad (liftIO)
|
import CoreMonad (liftIO)
|
||||||
import Exception
|
import GHC (Ghc, LoadHowMuch(LoadAllTargets))
|
||||||
import GHC
|
import qualified GHC as G
|
||||||
import Language.Haskell.GhcMod.ErrMsg
|
import Language.Haskell.GhcMod.ErrMsg
|
||||||
import Language.Haskell.GhcMod.GHCApi
|
import Language.Haskell.GhcMod.GHCApi
|
||||||
import Language.Haskell.GhcMod.Types
|
import Language.Haskell.GhcMod.Types
|
||||||
@ -33,12 +33,12 @@ check :: Options
|
|||||||
-> [FilePath] -- ^ The target files.
|
-> [FilePath] -- ^ The target files.
|
||||||
-> Ghc [String]
|
-> Ghc [String]
|
||||||
check _ _ [] = error "ghc-mod: check: No files given"
|
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
|
where
|
||||||
checkIt = do
|
checkIt = do
|
||||||
(readLog,_) <- initializeFlagsWithCradle opt cradle options True
|
(readLog,_) <- initializeFlagsWithCradle opt cradle options True
|
||||||
setTargetFiles fileNames
|
setTargetFiles fileNames
|
||||||
void $ load LoadAllTargets
|
void $ G.load LoadAllTargets
|
||||||
liftIO readLog
|
liftIO readLog
|
||||||
options
|
options
|
||||||
| expandSplice opt = "-w:" : ghcOpts opt
|
| expandSplice opt = "-w:" : ghcOpts opt
|
||||||
|
@ -7,10 +7,11 @@ module Language.Haskell.GhcMod.Cradle (
|
|||||||
, getPackageDbPackages
|
, getPackageDbPackages
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Char (isSpace)
|
|
||||||
import Control.Applicative ((<$>))
|
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 Control.Monad (filterM)
|
||||||
|
import Data.Char (isSpace)
|
||||||
import Data.List (isPrefixOf, isSuffixOf, tails)
|
import Data.List (isPrefixOf, isSuffixOf, tails)
|
||||||
import Language.Haskell.GhcMod.Types
|
import Language.Haskell.GhcMod.Types
|
||||||
import System.Directory (getCurrentDirectory, getDirectoryContents, doesFileExist)
|
import System.Directory (getCurrentDirectory, getDirectoryContents, doesFileExist)
|
||||||
@ -70,7 +71,7 @@ cabalDir :: FilePath -> IO (FilePath,FilePath)
|
|||||||
cabalDir dir = do
|
cabalDir dir = do
|
||||||
cnts <- getCabalFiles dir
|
cnts <- getCabalFiles dir
|
||||||
case cnts of
|
case cnts of
|
||||||
[] | dir' == dir -> throwIO $ userError "cabal files not found"
|
[] | dir' == dir -> E.throwIO $ userError "cabal files not found"
|
||||||
| otherwise -> cabalDir dir'
|
| otherwise -> cabalDir dir'
|
||||||
cfile:_ -> return (dir,dir </> cfile)
|
cfile:_ -> return (dir,dir </> cfile)
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user