From 50e35f0e98241b9cbe0f716ee16c5c5871599ae1 Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Fri, 20 Sep 2019 16:33:37 +0100 Subject: [PATCH] Use the hie-bios function that doesn't perform a downsweep. Fixes #99 (#102) --- exe/Main.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exe/Main.hs b/exe/Main.hs index e6a1eff402..4772498dd2 100644 --- a/exe/Main.hs +++ b/exe/Main.hs @@ -9,6 +9,7 @@ import Data.Maybe import Data.List.Extra import System.FilePath import Control.Concurrent.Extra +import Control.Exception import Control.Monad.Extra import Data.Default import System.Time.Extra @@ -41,7 +42,6 @@ import GHC hiding (def) import qualified GHC.Paths import HIE.Bios -import HIE.Bios.Ghc.Api (initializeFlagsWithCradle) -- Set the GHC libdir to the nix libdir if it's present. getLibdir :: IO FilePath @@ -130,9 +130,11 @@ showEvent lock (EventFileDiagnostics (toNormalizedFilePath -> file) diags) = showEvent lock e = withLock lock $ print e newSession' :: Cradle -> IO HscEnvEq -newSession' cradle = getLibdir >>= \libdir -> do +newSession' cradle = do + opts <- either throwIO return =<< getCompilerOptions "" cradle + libdir <- getLibdir env <- runGhc (Just libdir) $ do - initializeFlagsWithCradle "" cradle + _targets <- initSession opts getSession initDynLinker env newHscEnvEq env