ghcid 0.8.4 → 0.8.5
raw patch · 3 files changed
+16/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +2/−0
- ghcid.cabal +1/−1
- src/Ghcid.hs +13/−8
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for ghcid (* = breaking change) +0.8.5, released 2020-03-19+ #311, allow --target with Stack 0.8.4, released 2020-03-15 #309, use cabal repl --repl-options to avoid errors 0.8.3, released 2020-03-10
ghcid.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: ghcid-version: 0.8.4+version: 0.8.5 license: BSD3 license-file: LICENSE category: Development
src/Ghcid.hs view
@@ -65,7 +65,7 @@ ,color :: ColorMode ,setup :: [String] ,allow_eval :: Bool- ,target :: Maybe String+ ,target :: [String] } deriving (Data,Typeable,Show) @@ -104,7 +104,7 @@ ,color = Auto &= name "colour" &= name "color" &= opt Always &= typ "always/never/auto" &= help "Color output (defaults to when the terminal supports it)" ,setup = [] &= name "setup" &= typ "COMMAND" &= help "Setup commands to pass to ghci on stdin, usually :set <something>" ,allow_eval = False &= name "allow-eval" &= help "Execute REPL commands in comments"- ,target = Nothing &= typ "TARGET" &= help "Cabal target to build (e.g. lib:foo)"+ ,target = [] &= typ "TARGET" &= help "Target Component to build (e.g. lib:foo for Cabal, foo:lib for Stack)" } &= verbosity &= program "ghcid" &= summary ("Auto reloading GHCi daemon v" ++ showVersion version) @@ -144,15 +144,20 @@ let yaml = dir </> "stack.yaml" b <- doesFileExist yaml &&^ doesDirectoryExist (dir </> ".stack-work") pure $ if b then Just yaml else Nothing- stack <- firstJustM findStack [".",".."] -- stack file might be parent, see #62+ stackFile <- firstJustM findStack [".",".."] -- stack file might be parent, see #62 let cabal = map (curdir </>) $ filter ((==) ".cabal" . takeExtension) files- let isLib = isPrefixOf "lib:"- let opts = ["-fno-code" | null test && null run && not allow_eval && all isLib target] ++ ghciFlagsRequired ++ ghciFlagsUseful+ let isLib = isPrefixOf "lib:" -- `lib:foo` is the Cabal format+ let noCode = [ "-fno-code"+ | null test+ && null run+ && not allow_eval+ && (isJust stackFile || all isLib target) ]+ let opts = noCode ++ ghciFlagsRequired ++ ghciFlagsUseful pure $ case () of- _ | Just stack <- stack ->+ _ | Just stack <- stackFile -> let flags = if null arguments then- "stack ghci --test --bench" :+ "stack ghci" : target ++ "--test --bench" : ["--no-load" | ".ghci" `elem` files] ++ map ("--ghci-options=" ++) opts else@@ -160,7 +165,7 @@ in f flags $ stack:cabal | ".ghci" `elem` files -> f ("ghci":opts) [curdir </> ".ghci"] | cabal /= [] ->- let useCabal = ["cabal","repl"] ++ maybeToList target ++ map ("--repl-options=" ++) opts+ let useCabal = ["cabal","repl"] ++ target ++ map ("--repl-options=" ++) opts useGhci = "cabal exec -- ghci":opts in f (if null arguments then useCabal else useGhci) cabal | otherwise -> f ("ghci":opts) []