From 196bdbae986ddf887f92999b26129085a8ed0be5 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Wed, 22 Nov 2017 03:41:54 -0800 Subject: [PATCH] Fix package-hiding option parsing + always expose base to ghci --- src/Stack/Ghci.hs | 8 +++++++- src/Stack/Options/GhciParser.hs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index 9f0a12fb67..65358fd91f 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -323,7 +323,13 @@ runGhci GhciOpts{..} targets mainIsTargets pkgs extraFiles exposePackages = do fromMaybe (not (null pkgs && null exposePackages)) ghciHidePackages hidePkgOpts = if shouldHidePackages - then "-hide-all-packages" : concatMap (\n -> ["-package", packageNameString n]) exposePackages + 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" : + concatMap (\n -> ["-package", packageNameString n]) exposePackages else [] oneWordOpts bio | shouldHidePackages = bioOneWordOpts bio ++ bioPackageFlags bio diff --git a/src/Stack/Options/GhciParser.hs b/src/Stack/Options/GhciParser.hs index 878bf32236..3ef558064e 100644 --- a/src/Stack/Options/GhciParser.hs +++ b/src/Stack/Options/GhciParser.hs @@ -52,6 +52,6 @@ ghciOptsParser = GhciOpts <*> switch (long "load-local-deps" <> help "Load all local dependencies of your targets") -- TODO: deprecate this? probably useless. <*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies" <> internal) - <*> optional (boolFlags True "package-hiding" "package hiding" idm) + <*> optional (boolFlagsNoDefault "package-hiding" "package hiding" idm) <*> switch (long "no-build" <> help "Don't build before launching GHCi" <> internal) <*> switch (long "only-main" <> help "Only load and import the main module. If no main module, no modules will be loaded.")