fixing terrible bug on Maybe.
This commit is contained in:
parent
dced95031a
commit
7474968486
8
Cabal.hs
8
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)
|
||||
|
8
Gap.hs
8
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
|
||||
-}
|
||||
|
||||
----------------------------------------------------------------
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user