Skip to content

Commit a1987c8

Browse files
committed
Omit main module selection in ghci --no-load
1 parent 697e064 commit a1987c8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Stack/Ghci.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ ghci GhciOpts{..} = do
9898
(targets,mainIsTargets,pkgs) <- ghciSetup bopts ghciNoBuild ghciSkipIntermediate ghciMainIs ghciAdditionalPackages
9999
config <- asks getConfig
100100
bconfig <- asks getBuildConfig
101-
mainFile <- figureOutMainFile bopts mainIsTargets targets pkgs
102101
wc <- getWhichCompiler
103102
let pkgopts = hidePkgOpt ++ genOpts ++ ghcOpts
104103
hidePkgOpt = if null pkgs || not ghciHidePackages then [] else ["-hide-all-packages"]
@@ -119,11 +118,12 @@ ghci GhciOpts{..} = do
119118
("The following GHC options are incompatible with GHCi and have not been passed to it: " <>
120119
T.unwords (map T.pack (nubOrd omittedOpts)))
121120
oiDir <- objectInterfaceDir bconfig
122-
let modulesToLoad = nubOrd $
123-
concatMap (map display . S.toList . ghciPkgModules) pkgs
124-
thingsToLoad =
125-
maybe [] (return . toFilePath) mainFile <> modulesToLoad
126-
odir =
121+
(modulesToLoad, thingsToLoad) <- if ghciNoLoadModules then return ([], []) else do
122+
mainFile <- figureOutMainFile bopts mainIsTargets targets pkgs
123+
let modulesToLoad = nubOrd $ concatMap (map display . S.toList . ghciPkgModules) pkgs
124+
thingsToLoad = maybe [] (return . toFilePath) mainFile <> modulesToLoad
125+
return (modulesToLoad, thingsToLoad)
126+
let odir =
127127
[ "-odir=" <> toFilePathNoTrailingSep oiDir
128128
, "-hidir=" <> toFilePathNoTrailingSep oiDir ]
129129
$logInfo

0 commit comments

Comments
 (0)