@@ -14,10 +14,11 @@ import GHC.Paths (libdir)
14import GHC.LanguageExtensions
14import GHC.LanguageExtensions
15import DynFlags
15import DynFlags
16import Panic
16import Panic
17−import Outputable hiding ((<>))
17+import Outputable --hiding ((<>))
18import PprTyThing
18import PprTyThing
19import Type hiding (pprTyThing)
19import Type hiding (pprTyThing)
20import System.FilePath.Glob
20import System.FilePath.Glob
22data ScriptSession = ScriptSession {
23data ScriptSession = ScriptSession {
23 hscEnv :: HscEnv,
24 hscEnv :: HscEnv,
@@ -42,21 +43,25 @@ initScriptSession ghcPkgPaths = do
42 safeHaskell = Sf_Trustworthy,
43 safeHaskell = Sf_Trustworthy,
43 safeInfer = True,
44 safeInfer = True,
44 safeInferred = True,
45 safeInferred = True,
47+#if __GLASGOW_HASKELL__ >= 800
45− --trustFlags = [TrustPackage "base"] -- new in 8
48+ trustFlags = map TrustPackage required_packages,
46 packageFlags = (packageFlags dflags) ++ packages,
50 packageFlags = (packageFlags dflags) ++ packages,
47− extraPkgConfs = const ([GlobalPkgConf, UserPkgConf] ++ localPkgPaths)
51+ extraPkgConfs = const (localPkgPaths ++ [UserPkgConf, GlobalPkgConf])
49 applyGopts flags = foldl gopt_set flags gopts
53 applyGopts flags = foldl gopt_set flags gopts
50 applyXopts flags = foldl xopt_set flags xopts
54 applyXopts flags = foldl xopt_set flags xopts
51#if __GLASGOW_HASKELL__ >= 800
55#if __GLASGOW_HASKELL__ >= 800
52 xopts = [OverloadedStrings, ExtendedDefaultRules, ImplicitPrelude, ScopedTypeVariables]
56 xopts = [OverloadedStrings, ExtendedDefaultRules, ImplicitPrelude, ScopedTypeVariables]
53− gopts = [Opt_DistrustAllPackages, Opt_PackageTrust]
55 xopts = [Opt_OverloadedStrings, Opt_ExtendedDefaultRules, Opt_ImplicitPrelude, Opt_ScopedTypeVariables]
58 xopts = [Opt_OverloadedStrings, Opt_ExtendedDefaultRules, Opt_ImplicitPrelude, Opt_ScopedTypeVariables]
56− gopts = [Opt_DistrustAllPackages, Opt_PackageTrust]
60+ gopts = [] --[Opt_DistrustAllPackages, Opt_PackageTrust]
58 required_packages = ["base",
61 required_packages = ["base",
59 "containers",
62 "containers",
60 "unordered-containers",
65 "unordered-containers",
61 "hashable",
66 "hashable",
@@ -70,9 +75,9 @@ initScriptSession ghcPkgPaths = do
70#if __GLASGOW_HASKELL__ >= 800
75#if __GLASGOW_HASKELL__ >= 800
71 packages = map (\m -> ExposePackage ("-package " ++ m) (PackageArg m) (ModRenaming True [])) required_packages
76 packages = map (\m -> ExposePackage ("-package " ++ m) (PackageArg m) (ModRenaming True [])) required_packages
74 packages = map TrustPackage required_packages
78 packages = map TrustPackage required_packages
80+ --liftIO $ traceShowM (showSDoc dflags' (ppr packages))
76 _ <- setSessionDynFlags dflags'
81 _ <- setSessionDynFlags dflags'
77 let safeImportDecl mn = ImportDecl {
82 let safeImportDecl mn = ImportDecl {
78 ideclSourceSrc = Nothing,
83 ideclSourceSrc = Nothing,