@@ -54,7 +54,7 @@ findLocalCradle fp = do
5454 debugm $ " Found \" " ++ yaml ++ " \" for \" " ++ fp ++ " \" "
5555 crdl <- Bios. loadCradle yaml
5656 return $ fmap (const CabalNone ) crdl
57- Nothing -> Bios. loadImplicitCradle fp -- cabalHelperCradle fp
57+ Nothing -> Bios. loadImplicitCradle (fp </> " Foo.hs " ) -- cabalHelperCradle fp
5858 logm $ " Module \" " ++ fp ++ " \" is loaded by Cradle: " ++ show crdl
5959 return crdl
6060
@@ -100,7 +100,7 @@ data CabalHelper
100100execProjectGhc :: Cradle CabalHelper -> [String ] -> IO (Maybe String )
101101execProjectGhc crdl args = do
102102 isStackInstalled <- isJust <$> findExecutable " stack"
103- -- isCabalInstalled <- isJust <$> findExecutable "cabal"
103+ isCabalInstalled <- isJust <$> findExecutable " cabal"
104104 ghcOutput <- if isStackCradle crdl && isStackInstalled
105105 then do
106106 logm $ " Executing Stack GHC with args: " <> unwords args
@@ -112,11 +112,11 @@ execProjectGhc crdl args = do
112112 -- This command must work though before the project is build.
113113 -- Therefore, fallback to "ghc" on the path.
114114 --
115- -- else if isCabalCradle crdl && isCabalInstalled then do
116- -- let cmd = "cabal v2-exec -v0 ghc -- " ++ unwords args
117- -- catch (Just <$> tryCommand crdl cmd) $ \(_ ::IOException) -> do
118- -- errorm $ "Command `" ++ cmd ++ "` failed."
119- -- return Nothing
115+ else if isCabalCradle crdl && isCabalInstalled then do
116+ let cmd = " cabal v2-exec -v0 ghc -- " ++ unwords args
117+ catch (Just <$> tryCommand crdl cmd) $ \ (_ :: IOException ) -> do
118+ errorm $ " Command `" ++ cmd ++ " ` failed."
119+ return Nothing
120120 else do
121121 logm $ " Executing GHC on path with args: " <> unwords args
122122 execWithGhc
@@ -153,15 +153,6 @@ tryCommand crdl cmd = do
153153 ExitSuccess -> return $ T. unpack . T. strip . head . T. lines $ T. pack sout
154154
155155
156- -- | Get the directory of the libdir based on the project ghc.
157- getProjectGhcLibDir :: Cradle CabalHelper -> IO (Maybe FilePath )
158- getProjectGhcLibDir crdl =
159- execProjectGhc crdl [" --print-libdir" ] >>= \ case
160- Nothing -> do
161- errorm " Could not obtain the libdir."
162- return Nothing
163- mlibdir -> return mlibdir
164-
165156 -- ---------------------------------------------------------------------
166157
167158
@@ -469,8 +460,8 @@ cabalHelperCradle file = do
469460 { componentOptions = [file, fixImportDirs cwd " -i." ]
470461 , componentRoot = cwd
471462 , componentDependencies = []
472- , ghcLibDir = Nothing
473463 }
464+ , runGhcLibDir = pure Nothing
474465 }
475466 }
476467 Just (Ex proj) -> do
@@ -498,6 +489,7 @@ cabalHelperCradle file = do
498489 , cradleOptsProg =
499490 CradleAction { actionName = Bios. Other (projectNoneType proj)
500491 , runCradle = \ _ _ -> return CradleNone
492+ , runGhcLibDir = pure Nothing
501493 }
502494 }
503495 Just realPackage -> do
@@ -518,6 +510,7 @@ cabalHelperCradle file = do
518510 realPackage
519511 normalisedPackageLocation
520512 fp
513+ , runGhcLibDir = pure Nothing
521514 }
522515 }
523516
@@ -555,7 +548,6 @@ cabalHelperAction proj env package root fp = do
555548 ComponentOptions { componentOptions = ghcOptions
556549 , componentRoot = root
557550 , componentDependencies = []
558- , ghcLibDir = Nothing
559551 }
560552 Left err -> return
561553 $ CradleFail
0 commit comments