symplify code. Note that parseDynamicFlags is essential, cannot be omitted.
This commit is contained in:
parent
e35d195cc3
commit
90d6a70811
12
Check.hs
12
Check.hs
@ -21,6 +21,7 @@ checkSyntax _ file = unlines <$> check file
|
|||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
-- I don't know why, but parseDynamicFlags must be used.
|
||||||
cmdOptions :: [Located String]
|
cmdOptions :: [Located String]
|
||||||
cmdOptions = map noLoc ["-Wall","-fno-warn-unused-do-bind"]
|
cmdOptions = map noLoc ["-Wall","-fno-warn-unused-do-bind"]
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ check fileName = ghandle ignore $ runGhc (Just libdir) $ do
|
|||||||
loadWithLogger (refLogger ref) LoadAllTargets
|
loadWithLogger (refLogger ref) LoadAllTargets
|
||||||
liftIO $ readIORef ref
|
liftIO $ readIORef ref
|
||||||
where
|
where
|
||||||
|
-- I don't know why, but parseDynamicFlags must be used.
|
||||||
initSession = do
|
initSession = do
|
||||||
dflags <- getSessionDynFlags
|
dflags <- getSessionDynFlags
|
||||||
(dflags',_,_) <- parseDynamicFlags dflags cmdOptions
|
(dflags',_,_) <- parseDynamicFlags dflags cmdOptions
|
||||||
@ -58,14 +60,20 @@ refLogger ref (Just e) = do
|
|||||||
|
|
||||||
setFlags :: DynFlags -> DynFlags
|
setFlags :: DynFlags -> DynFlags
|
||||||
setFlags d = d {
|
setFlags d = d {
|
||||||
importPaths = importPaths d ++ ["..","../..","../../..","../../../../.."]
|
importPaths = importPaths d ++ importDirs
|
||||||
, packageFlags = ExposePackage "ghc" : packageFlags d
|
, packageFlags = ghcPackage : packageFlags d
|
||||||
, ghcLink = NoLink
|
, ghcLink = NoLink
|
||||||
-- GHC.desugarModule does not produces the pattern warnings, why?
|
-- GHC.desugarModule does not produces the pattern warnings, why?
|
||||||
-- , hscTarget = HscNothing
|
-- , hscTarget = HscNothing
|
||||||
, hscTarget = HscInterpreted
|
, hscTarget = HscInterpreted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
importDirs :: [String]
|
||||||
|
importDirs = ["..","../..","../../..","../../../../.."]
|
||||||
|
|
||||||
|
ghcPackage :: PackageFlag
|
||||||
|
ghcPackage = ExposePackage "ghc"
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
showErrMsg :: ErrMsg -> String
|
showErrMsg :: ErrMsg -> String
|
||||||
|
Loading…
Reference in New Issue
Block a user