From 99950cfae2e014f76abbebd51869e5cae5f00a6a Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Sat, 20 Jan 2018 00:32:19 -0800 Subject: [PATCH] Have "stack ghci" only use "-package base" if there are no local targets --- ChangeLog.md | 6 +++++- src/Stack/Ghci.hs | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 272904b3b8..7169bf5e2c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -66,8 +66,12 @@ Bug fixes: associated with the relevant custom snapshot. See [#3714](https://github.com/commercialhaskell/stack/issues/3714). * `stack ghci` now allows loading multiple packages with the same - module name, as long as they are the same filepath. See + module name, as long as they have the same filepath. See [#3776](https://github.com/commercialhaskell/stack/pull/3776). +* `stack ghci` no longer always adds a dependency on `base`. It is + now only added when there are no local targets. This allows it to + be to load code that uses replacements for `base`. See + [#3589](https://github.com/commercialhaskell/stack/issues/3589#issuecomment) ## v1.6.3 diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index 868f89bf44..1c414d8c0e 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -331,12 +331,13 @@ runGhci GhciOpts{..} targets mainIsTargets pkgs extraFiles exposePackages = do fromMaybe (not (null pkgs && null exposePackages)) ghciHidePackages hidePkgOpts = if shouldHidePackages - then "-hide-all-packages" : + then + ["-hide-all-packages"] ++ -- This is necessary, because current versions of ghci -- will entirely fail to start if base isn't visible. This -- is because it tries to use the interpreter to set -- buffering options on standard IO. - "-package" : "base" : + (if null targets then ["-package", "base"] else []) ++ concatMap (\n -> ["-package", packageNameString n]) exposePackages else [] oneWordOpts bio