Respect the user's configuration settings

Only lookup user configuration before doing a search; implement version completion for Cabal and HLS removal
This commit is contained in:
Huw campbell
2021-02-25 12:45:52 +11:00
committed by Huw Campbell
parent 1a5f0259f4
commit 453a29fdf7
2 changed files with 15 additions and 10 deletions

View File

@@ -185,9 +185,9 @@ getDirs = do
ghcupConfigFile :: (MonadIO m)
=> Excepts '[JSONError] m UserSettings
ghcupConfigFile = do
confDir <- liftIO $ ghcupConfigDir
confDir <- liftIO ghcupConfigDir
let file = confDir </> [rel|config.yaml|]
bs <- liftIO $ handleIO' NoSuchThing (\_ -> pure $ Nothing) $ fmap Just $ readFile file
bs <- liftIO $ handleIO' NoSuchThing (\_ -> pure Nothing) $ Just <$> readFile file
case bs of
Nothing -> pure defaultUserSettings
Just bs' -> lE' JSONDecodeError . bimap show id . Y.decodeEither' . L.toStrict $ bs'