Skip to content

Commit a699e4f

Browse files
committed
Use target components when starting a REPL
This partially fixes #5213 - starting a repl for an exe component doesn't appear to work for some reason
1 parent c467d1b commit a699e4f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Stack/Ghci.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,13 @@ ghci opts@GhciOpts{..} = do
183183
-- need is the location of main modules, not the rest.
184184
pkgs0 <- getGhciPkgInfos installMap addPkgs (fmap fst mfileTargets) pkgDescs
185185
figureOutMainFile bopts mainIsTargets localTargets pkgs0
186+
let pkgTargets pn targets =
187+
case targets of
188+
TargetAll _ -> [T.pack (packageNameString pn)]
189+
TargetComps comps -> [renderPkgComponent (pn, c) | c <- toList comps]
186190
-- Build required dependencies and setup local packages.
187-
buildDepsAndInitialSteps opts (map (T.pack . packageNameString . fst) localTargets)
191+
buildDepsAndInitialSteps opts $
192+
concatMap (\(pn, (_, t)) -> pkgTargets pn t) localTargets
188193
targetWarnings localTargets nonLocalTargets mfileTargets
189194
-- Load the list of modules _after_ building, to catch changes in
190195
-- unlisted dependencies (#1180)

0 commit comments

Comments
 (0)