Skip to content

Commit 62f6709

Browse files
authored
Merge pull request #6140 from commercialhaskell/fix6139
Fix #6139 Avoid unnecessary 'Found acceptable Hoogle in index'
2 parents 31a54bb + fd8198b commit 62f6709

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Bug fixes:
2222

2323
* Restore building of Stack with Cabal flag `disable-git-info` (broken with
2424
Stack 2.11.1).
25+
* With `stack hoogle`, avoid the message
26+
`Minimum version is hoogle-5.0. Found acceptable hoogle-<x.y.z> in your index, requiring its installation.`
27+
when a `hoogle` executable has already been found on the `PATH`.
2528
* Stack's sanity check on a selected GHC now passes GHC flag
2629
`-hide-all-packages`, stopping GHC from looking for a package environment in
2730
default locations.

src/Stack/Hoogle.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Stack.Hoogle
88

99
import qualified Data.ByteString.Lazy.Char8 as BL8
1010
import Data.Char ( isSpace )
11+
import Data.Either.Extra ( eitherToMaybe )
1112
import qualified Data.Text as T
1213
import Distribution.PackageDescription ( packageDescription, package )
1314
import Distribution.Types.PackageName ( mkPackageName )
@@ -226,11 +227,13 @@ hoogleCmd (args, setup, rebuild, startServer) =
226227
ensureHoogleInPath = do
227228
config <- view configL
228229
menv <- liftIO $ configProcessContextSettings config envSettings
229-
mhooglePath <- runRIO menv (findExecutable "hoogle") <>
230-
requiringHoogle NotMuted (findExecutable "hoogle")
231-
eres <- case mhooglePath of
232-
Left _ -> pure $ Left (flow "Hoogle isn't installed.")
233-
Right hooglePath -> do
230+
mHooglePath' <- eitherToMaybe <$> runRIO menv (findExecutable "hoogle")
231+
let mHooglePath'' =
232+
eitherToMaybe <$> requiringHoogle NotMuted (findExecutable "hoogle")
233+
mHooglePath <- maybe mHooglePath'' (pure . Just) mHooglePath'
234+
eres <- case mHooglePath of
235+
Nothing -> pure $ Left (flow "Hoogle isn't installed.")
236+
Just hooglePath -> do
234237
result <- withProcessContext menv
235238
$ proc hooglePath ["--numeric-version"]
236239
$ tryAny . fmap fst . readProcess_

0 commit comments

Comments
 (0)