leksah-server 0.8.0.1 → 0.8.0.2
raw patch · 2 files changed
+9/−39 lines, 2 files
Files
- leksah-server.cabal +1/−1
- src/IDE/Utils/GHCUtils.hs +8/−38
leksah-server.cabal view
@@ -1,5 +1,5 @@ name: leksah-server-version: 0.8.0.1+version: 0.8.0.2 cabal-version: >= 1.2 build-type: Simple license: GPL
src/IDE/Utils/GHCUtils.hs view
@@ -18,7 +18,6 @@ , findFittingPackages , myParseModule , myParseHeader-, findAndReadIface2 ) where #if MIN_VERSION_Cabal(1,8,0)@@ -31,35 +30,26 @@ #else import qualified Distribution.InstalledPackageInfo as IPI (package) #endif-import GHC hiding (SuccessFlag, Failed, Succeeded)+import GHC import DriverPipeline(preprocess) import StringBuffer (StringBuffer(..),hGetStringBuffer) import FastString (mkFastString) import Lexer (mkPState,ParseResult(..),getMessages,unP)-import Outputable (showSDoc, text, ppr)-import ErrUtils- (Message, dumpIfSet_dyn, printErrorsAndWarnings, mkPlainErrMsg,- showPass, ErrMsg(..))+import Outputable (ppr)+import ErrUtils (dumpIfSet_dyn,printErrorsAndWarnings,mkPlainErrMsg,showPass,ErrMsg(..)) import PackageConfig (PackageConfig) import Data.Foldable (maximumBy) import qualified Parser as P (parseModule,parseHeader) import HscStats (ppSourceStats)-import HscTypes- (mi_module, FindResult(..), ModIface(..), HscEnv(..))+import Control.Monad.Trans+import HscTypes (Ghc(..)) import IDE.Utils.FileUtils (getSysLibDir) import DynFlags (dopt_set) import System.Log.Logger(warningM, debugM)-import qualified GHC as Module (ModuleName)-import TcRnMonad (TcRnIf)-import Finder (findHomeModule)-import System.Directory (canonicalizePath)-import LoadIface (readIface)-import Maybes (MaybeErr(..), MaybeErr)-import MonadUtils (MonadIO(..)) ----- this should not be repeated here, why is it necessary?---instance MonadIO Ghc where--- liftIO ioA = Ghc $ \_ -> ioA+-- this should not be repeated here, why is it necessary?+instance MonadIO Ghc where+ liftIO ioA = Ghc $ \_ -> ioA inGhcIO :: [String] -> [DynFlag] -> (DynFlags -> Ghc a) -> IO a inGhcIO flags' udynFlags ghcAct = do@@ -128,26 +118,6 @@ in if length filtered > 1 then [maximumBy (\a b -> compare (pkgVersion a) (pkgVersion b)) filtered] else filtered-- ------------------------------------------------------------------------ | Reading an interface file-findAndReadIface2 :: HscEnv -> Module.ModuleName -> Module -> TcRnIf gbl lcl (MaybeErr Message (ModIface, FilePath))-findAndReadIface2 session modName = do- mb_found <- liftIO $ findHomeModule session modName- case mb_found of- Found loc mod' -> do- let file_path = ml_hi_file loc--- filePath <- liftIO $ canonicalizePath file_path- read_result <- readIface mod' file_path False- case read_result of- Failed mess -> return (Failed (text $ "can't read iface " ++- moduleNameString modName ++ " at " ++ file_path ++ " " ++ showSDoc mess))- Succeeded iface- | mi_module iface /= mod'- -> return (Failed (text $ "read but not equal" ++ moduleNameString modName))- | otherwise- -> return (Succeeded (iface, file_path))- _ -> return (Failed (text $ "can't locate " ++ moduleNameString modName)) --------------------------------------------------------------------- -- | Parser function copied here, because it is not exported