From a93ed8c7d93df1860d2e56b400b724ac47edf470 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Wed, 31 Jul 2019 17:07:39 +0200 Subject: Merge CompPrograms back into Programs We need to support passing down the path to ghc to new-build/stack in order to support using a non-default 'ghc' executable. --- src/CabalHelper/Compiletime/Program/GHC.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/CabalHelper/Compiletime/Program/GHC.hs') diff --git a/src/CabalHelper/Compiletime/Program/GHC.hs b/src/CabalHelper/Compiletime/Program/GHC.hs index 547911f..e45d921 100644 --- a/src/CabalHelper/Compiletime/Program/GHC.hs +++ b/src/CabalHelper/Compiletime/Program/GHC.hs @@ -66,25 +66,25 @@ newtype GhcVersion = GhcVersion { unGhcVersion :: Version } showGhcVersion :: GhcVersion -> String showGhcVersion (GhcVersion v) = showVersion v -ghcVersion :: (Verbose, CProgs) => IO GhcVersion +ghcVersion :: (Verbose, Progs) => IO GhcVersion ghcVersion = GhcVersion . - parseVer . trim <$> readProcess' (ghcProgram ?cprogs) ["--numeric-version"] "" + parseVer . trim <$> readProcess' (ghcProgram ?progs) ["--numeric-version"] "" -ghcPkgVersion :: (Verbose, CProgs) => IO Version +ghcPkgVersion :: (Verbose, Progs) => IO Version ghcPkgVersion = parseVer . trim . dropWhile (not . isDigit) - <$> readProcess' (ghcPkgProgram ?cprogs) ["--version"] "" + <$> readProcess' (ghcPkgProgram ?progs) ["--version"] "" -createPkgDb :: (Verbose, CProgs) => UnpackedCabalVersion -> IO PackageDbDir +createPkgDb :: (Verbose, Progs) => UnpackedCabalVersion -> IO PackageDbDir createPkgDb cabalVer = do db@(PackageDbDir db_path) <- getPrivateCabalPkgDb $ unpackedToResolvedCabalVersion cabalVer exists <- doesDirectoryExist db_path when (not exists) $ - callProcessStderr Nothing (ghcPkgProgram ?cprogs) ["init", db_path] + callProcessStderr Nothing (ghcPkgProgram ?progs) ["init", db_path] return db -getPrivateCabalPkgDb :: (Verbose, CProgs) => ResolvedCabalVersion -> IO PackageDbDir +getPrivateCabalPkgDb :: (Verbose, Progs) => ResolvedCabalVersion -> IO PackageDbDir getPrivateCabalPkgDb cabalVer = do appdir <- appCacheDir ghcVer <- ghcVersion @@ -113,7 +113,7 @@ listCabalVersions mdb = do let mdbopt = ("--package-conf="++) <$> mdb_path args = ["list", "--simple-output", "Cabal"] ++ maybeToList mdbopt catMaybes . map (fmap snd . parsePkgId) . words - <$> readProcess' (ghcPkgProgram ?cprogs) args "" + <$> readProcess' (ghcPkgProgram ?progs) args "" _ -> mzero cabalVersionExistsInPkgDb @@ -136,7 +136,7 @@ cabalVersionExistsInPkgDb cabalVer db@(PackageDbDir db_path) = do invokeGhc :: Env => GhcInvocation -> IO (Either ExitCode FilePath) invokeGhc GhcInvocation {..} = do - rv <- callProcessStderr' Nothing (ghcProgram ?cprogs) $ concat + rv <- callProcessStderr' Nothing (ghcProgram ?progs) $ concat [ [ "-outputdir", giOutDir , "-o", giOutput ] -- cgit v1.2.3