mirror of
https://github.com/haskell/haskell-ide-engine.git
synced 2024-10-26 11:18:42 +03:00
Use ghc versions from stack-*.yaml files
This commit is contained in:
parent
f37b98714e
commit
756d51df95
@ -43,15 +43,6 @@ existsExecutable executable = liftIO $ isJust <$> findExecutable executable
|
||||
isWindowsSystem :: Bool
|
||||
isWindowsSystem = os `elem` ["mingw32", "win32"]
|
||||
|
||||
-- | Defines all different hie versions that are supported.
|
||||
-- On windows, `8.6.3` is excluded as this version of ghc does not work there
|
||||
supportedGhcVersions :: [VersionNumber]
|
||||
supportedGhcVersions = sort (commonVersions ++ osVersions)
|
||||
where commonVersions = ["8.4.2", "8.4.3", "8.4.4", "8.6.1", "8.6.2", "8.6.4", "8.6.5"]
|
||||
-- the following lines exclude `8.6.3` on windows systems
|
||||
osVersions | isWindowsSystem = []
|
||||
| otherwise = ["8.6.3"]
|
||||
|
||||
findInstalledGhcs :: IO [(VersionNumber, GhcPath)]
|
||||
findInstalledGhcs = do
|
||||
hieVersions <- getHieVersions :: IO [VersionNumber]
|
||||
@ -62,7 +53,7 @@ findInstalledGhcs = do
|
||||
)
|
||||
(reverse hieVersions)
|
||||
-- filter out not supported ghc versions
|
||||
availableGhcs <- filter ((`elem` supportedGhcVersions) . fst) <$> getGhcPaths
|
||||
availableGhcs <- filter ((`elem` hieVersions) . fst) <$> getGhcPaths
|
||||
return
|
||||
-- sort by version to make it coherent with getHieVersions
|
||||
$ sortBy (comparing fst)
|
||||
@ -113,7 +104,8 @@ getHieVersions = do
|
||||
& mapMaybe
|
||||
(T.stripPrefix stackYamlPrefix >=> T.stripSuffix stackYamlSuffix)
|
||||
& map T.unpack
|
||||
& filter (\p -> p `elem` supportedGhcVersions)
|
||||
-- the following line excludes `8.6.3` on windows systems
|
||||
& filter (\p -> not isWindowsSystem || p /= "8.6.3")
|
||||
& sort
|
||||
return hieVersions
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user