diff --git a/Cabal.hs b/Cabal.hs index 40f611c..c1e79b0 100644 --- a/Cabal.hs +++ b/Cabal.hs @@ -34,7 +34,7 @@ initializeGHC opt fileName ghcOptions logging = return (fileName,logReader) withCabal = do (owdir,cdir,cfile) <- liftIO getDirs - binfo <- parseCabalFile cfile + binfo <- liftIO $ parseCabalFile cfile let (idirs',exts',mlang) = extractBuildInfo binfo exts = map addX exts' lang = maybe "-XHaskell98" addX mlang @@ -51,10 +51,10 @@ initializeGHC opt fileName ghcOptions logging = ---------------------------------------------------------------- -- Causes error, catched in the upper function. -parseCabalFile :: FilePath -> Ghc BuildInfo +parseCabalFile :: FilePath -> IO BuildInfo parseCabalFile file = do - cabal <- liftIO $ readPackageDescription silent file - return . fromJust $ fromLibrary cabal >> fromExecutable cabal + cabal <- readPackageDescription silent file + return . fromJust $ fromLibrary cabal <|> fromExecutable cabal where fromLibrary c = libBuildInfo . condTreeData <$> condLibrary c fromExecutable c = buildInfo . condTreeData . snd <$> toMaybe (condExecutables c) diff --git a/Gap.hs b/Gap.hs index 20ad2e6..e2e1286 100644 --- a/Gap.hs +++ b/Gap.hs @@ -31,6 +31,14 @@ import HscTypes (liftIO) import Pretty #endif +{- +pretty :: Outputable a => a -> String +pretty = showSDocForUser neverQualify . ppr + +debug :: Outputable a => a -> b -> b +debug x v = trace (pretty x) v +-} + ---------------------------------------------------------------- ----------------------------------------------------------------