Skip to content

Commit dee0f76

Browse files
Support GHC 8
1 parent 98b1ffa commit dee0f76

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

src/System/Plugins/Env.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,14 @@ union ls ps' =
323323
grabDefaultPkgConf :: IO PkgEnvs
324324
grabDefaultPkgConf = do
325325
pc <- configureAllKnownPrograms silent defaultProgramConfiguration
326+
#if MIN_VERSION_Cabal(1,24,0)
327+
(compiler, _platform, _programConfiguration)
328+
<- configure silent Nothing Nothing pc
329+
pkgIndex <- getInstalledPackages silent compiler
330+
[GlobalPackageDB, UserPackageDB] pc
331+
#else
326332
pkgIndex <- getInstalledPackages silent [GlobalPackageDB, UserPackageDB] pc
333+
#endif
327334
return $ [] `union` allPackages pkgIndex
328335

329336
--
@@ -332,7 +339,13 @@ grabDefaultPkgConf = do
332339
readPackageConf :: FilePath -> IO [PackageConfig]
333340
readPackageConf f = do
334341
pc <- configureAllKnownPrograms silent defaultProgramConfiguration
342+
#if MIN_VERSION_Cabal(1,24,0)
343+
(compiler, _platform, _programConfiguration)
344+
<- configure silent Nothing Nothing pc
345+
pkgIndex <- getInstalledPackages silent compiler [GlobalPackageDB, UserPackageDB, SpecificPackageDB f] pc
346+
#else
335347
pkgIndex <- getInstalledPackages silent [GlobalPackageDB, UserPackageDB, SpecificPackageDB f] pc
348+
#endif
336349
return $ allPackages pkgIndex
337350

338351
-- -----------------------------------------------------------

src/System/Plugins/Load.hs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,16 @@ import System.Plugins.LoadTypes
7272
-- import Language.Hi.Parser
7373
import BinIface
7474
import HscTypes
75-
#if MIN_VERSION_ghc(7,10,0)
76-
import Module (moduleName, moduleNameString, packageKeyString)
75+
76+
import Module (moduleName, moduleNameString)
77+
#if MIN_VERSION_ghc(8,0,0)
78+
import Module (unitIdString)
79+
#elif MIN_VERSION_ghc(7,10,0)
80+
import Module (packageKeyString)
7781
#else
78-
import Module (moduleName, moduleNameString, packageIdString)
82+
import Module (packageIdString)
7983
#endif
84+
8085
import HscMain (newHscEnv)
8186
import TcRnMonad (initTcRnIf)
8287

@@ -705,7 +710,9 @@ loadDepends obj incpaths = do
705710

706711
-- and find some packages to load, as well.
707712
let ps = dep_pkgs ds
708-
#if MIN_VERSION_ghc(7,10,0)
713+
#if MIN_VERSION_ghc(8,0,0)
714+
ps' <- filterM loaded . map unitIdString . nub $ map fst ps
715+
#elif MIN_VERSION_ghc(7,10,0)
709716
ps' <- filterM loaded . map packageKeyString . nub $ map fst ps
710717
#elif MIN_VERSION_ghc(7,2,0)
711718
ps' <- filterM loaded . map packageIdString . nub $ map fst ps

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# For more information, see: https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md
22

33
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
4-
resolver: lts-3.8
4+
resolver: lts-8.0
55

66
# Local packages, usually specified by relative directory name
77
packages:

0 commit comments

Comments
 (0)