on master help sign in
ezyang helped to identify that the GHC API 8 loading issue was merely the order of package databases!

fix atomfunctionscript test to ignore string arg

commit103b2aec0493b999a72011c5221db7dfbdadd8fa authorAgentM <agentm@themactionfaction.com> dateSat 7 Jan 2017, 11:19 (10 years ago) parent8d3847c
2 files changed+14−8
src/lib/ProjectM36/AtomFunctionBody.hs+11−6 test/TutorialD/Interpreter/AtomFunctionScript.hs+3−2
src/lib/ProjectM36/AtomFunctionBody.hs+11−6
@@ -14,10 +14,11 @@ import GHC.Paths (libdir)
1414import GHC.LanguageExtensions
1515import DynFlags
1616import Panic
17−import Outputable hiding ((<>))
17+import Outputable --hiding ((<>))
1818import PprTyThing
1919import Type hiding (pprTyThing)
2020import System.FilePath.Glob
21+import Debug.Trace
2122
2223data ScriptSession = ScriptSession {
2324 hscEnv :: HscEnv,
@@ -42,21 +43,25 @@ initScriptSession ghcPkgPaths = do
4243 safeHaskell = Sf_Trustworthy,
4344 safeInfer = True,
4445 safeInferred = True,
45− --trustFlags = [TrustPackage "base"] -- new in 8
46+ --verbosity = 3,
47+#if __GLASGOW_HASKELL__ >= 800
48+ trustFlags = map TrustPackage required_packages,
49+#endif
4650 packageFlags = (packageFlags dflags) ++ packages,
47− extraPkgConfs = const ([GlobalPkgConf, UserPkgConf] ++ localPkgPaths)
51+ extraPkgConfs = const (localPkgPaths ++ [UserPkgConf, GlobalPkgConf])
4852 }
4953 applyGopts flags = foldl gopt_set flags gopts
5054 applyXopts flags = foldl xopt_set flags xopts
5155#if __GLASGOW_HASKELL__ >= 800
5256 xopts = [OverloadedStrings, ExtendedDefaultRules, ImplicitPrelude, ScopedTypeVariables]
53− gopts = [Opt_DistrustAllPackages, Opt_PackageTrust]
5457#else
5558 xopts = [Opt_OverloadedStrings, Opt_ExtendedDefaultRules, Opt_ImplicitPrelude, Opt_ScopedTypeVariables]
56− gopts = [Opt_DistrustAllPackages, Opt_PackageTrust]
5759#endif
60+ gopts = [] --[Opt_DistrustAllPackages, Opt_PackageTrust]
5861 required_packages = ["base",
5962 "containers",
63+ "Glob",
64+ "directory",
6065 "unordered-containers",
6166 "hashable",
6267 "uuid",
@@ -70,9 +75,9 @@ initScriptSession ghcPkgPaths = do
7075#if __GLASGOW_HASKELL__ >= 800
7176 packages = map (\m -> ExposePackage ("-package " ++ m) (PackageArg m) (ModRenaming True [])) required_packages
7277#else
73−
7478 packages = map TrustPackage required_packages
7579#endif
80+ --liftIO $ traceShowM (showSDoc dflags' (ppr packages))
7681 _ <- setSessionDynFlags dflags'
7782 let safeImportDecl mn = ImportDecl {
7883 ideclSourceSrc = Nothing,
test/TutorialD/Interpreter/AtomFunctionScript.hs+3−2
@@ -37,9 +37,10 @@ testErrorAtomFunction = TestCase $ do
3737 let attrs = [Attribute "x" IntAtomType]
3838 funcAtomExpr = FunctionAtomExpr "mkTest" [NakedAtomExpr (IntAtom 3)] ()
3939 tupleExprs = [TupleExpr (M.singleton "x" funcAtomExpr)]
40− expectedResult = Left (UnhandledExceptionError "1")
4140 result <- executeRelationalExpr sess conn (MakeRelationFromExprs (Just (map NakedAttributeExpr attrs)) tupleExprs)
42− assertEqual "catch error exception from script" expectedResult result
41+ assertBool "catch error exception from script" (case result of
42+ Left (UnhandledExceptionError _) -> True
43+ _ -> False)
4344
4445testNoArgumentAtomFunction :: Test
4546testNoArgumentAtomFunction = TestCase $ do