Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change 'stack ghc' to provide package context #1737

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
don't touch module Stack.Ghci unnecessarily
Andrew Cady committed Feb 4, 2016
commit 93220b60b031bf3a3adf477537bac4b9c3bdac42
9 changes: 0 additions & 9 deletions src/Stack/Ghci.hs
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ module Stack.Ghci
, GhciPkgInfo(..)
, GhciException(..)
, ghciSetup
, ghciSetup'
, ghci
) where

@@ -102,14 +101,6 @@ instance Show GhciException where
, "Use --no-load to try to start it anyway, without loading any modules (but these are still likely to cause errors)"
]

ghciSetup' :: (MonadIO f, HasHttpManager r, MonadReader r f, MonadBaseControl IO f, MonadMask f, MonadLogger f, HasEnvConfig r, HasTerminal r, HasLogLevel r) => GhciOpts -> f [String]
ghciSetup' opts = genOpts . extract <$> ghciSetup opts
where
extract (_, _, x) = x
genOpts :: [GhciPkgInfo] -> [String]
genOpts pkgs = nubOrd (concatMap (concatMap (oneWordOpts . snd) . ghciPkgOpts) pkgs)
oneWordOpts bio = bioOneWordOpts bio ++ bioPackageFlags bio

-- | Launch a GHCi session for the given local package targets with the
-- given options and configure it with the load paths and extensions
-- of those targets.
8 changes: 7 additions & 1 deletion src/main/Main.hs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ import Data.Attoparsec.Interpreter (getInterpreterArgs)
import qualified Data.ByteString.Lazy as L
import Data.IORef
import Data.List
import Data.List.Extra (nubOrd)
import qualified Data.Map as Map
import qualified Data.Map.Strict as M
import Data.Maybe
@@ -1028,7 +1029,7 @@ execCmd ExecOpts {..} go@GlobalOpts{..} =

if eoCmd == ExecGhc || eoGhciPackages
then do
pkgOpts <- ghciSetup' ghciOpts
pkgOpts <- genOpts . extract <$> ghciSetup ghciOpts
exec menv cmd $ ("-i" : "-hide-all-packages" : pkgOpts) ++ args
else
exec menv cmd args
@@ -1039,6 +1040,11 @@ execCmd ExecOpts {..} go@GlobalOpts{..} =
return (cmd, args)
ghciOpts :: GhciOpts
ghciOpts = GhciOpts True [] Nothing False [] Nothing False False False defaultBuildOpts
extract (_, _, x) = x
genOpts :: [GhciPkgInfo] -> [String]
genOpts pkgs = nubOrd (concatMap (concatMap (oneWordOpts . snd) . ghciPkgOpts) pkgs)
oneWordOpts bio = bioOneWordOpts bio ++ bioPackageFlags bio


-- | Evaluate some haskell code inline.
evalCmd :: EvalOpts -> GlobalOpts -> IO ()
1 change: 1 addition & 0 deletions stack.cabal
Original file line number Diff line number Diff line change
@@ -257,6 +257,7 @@ executable stack
, conduit
, transformers
, http-client
, extra
default-language: Haskell2010
if os(windows)
build-depends: Win32