From 9c22ba9d45b44e69962efef028efc56f29ea7235 Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Sun, 25 Jul 2021 22:10:10 +0530 Subject: [PATCH] updates usages of `installHLSBin` across files --- app/ghcup/BrickMain.hs | 2 +- app/ghcup/Main.hs | 34 ++++++++++++++-------------------- lib/GHCup.hs | 5 +++-- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index 9fc9c7d..93ff739 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -457,7 +457,7 @@ install' _ (_, ListResult {..}) = do liftE $ upgradeGHCup Nothing False $> vi HLS -> do let vi = getVersionInfo lVer HLS dls - liftE $ installHLSBin lVer $> vi + liftE $ installHLSBin lVer Nothing $> vi Stack -> do let vi = getVersionInfo lVer Stack dls liftE $ installStackBin lVer $> vi diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index a945b9a..3b2e7aa 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1675,26 +1675,20 @@ Report bugs at |] pure $ ExitFailure 4 let installHLS InstallOptions{..} = - (case isolateDir of - Just isoDir -> runInstTool instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer HLS - let hlsVersion = (_tvVersion v) - liftE $ installHLSBinIsolated isoDir hlsVersion - pure vi - Nothing -> - case instBindist of - Nothing -> runInstTool instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer HLS - liftE $ installHLSBin (_tvVersion v) - pure vi - Just uri -> do - s' <- appState - runInstTool' s'{ settings = settings { noVerify = True}} instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer HLS - liftE $ installHLSBindist - (DownloadInfo uri Nothing "") - (_tvVersion v) - pure vi + (case instBindist of + Nothing -> runInstTool instPlatform $ do + (v, vi) <- liftE $ fromVersion instVer HLS + liftE $ installHLSBin (_tvVersion v) isolateDir + pure vi + Just uri -> do + s' <- appState + runInstTool' s'{ settings = settings { noVerify = True}} instPlatform $ do + (v, vi) <- liftE $ fromVersion instVer HLS + liftE $ installHLSBindist + (DownloadInfo uri Nothing "") + (_tvVersion v) + isolateDir + pure vi ) >>= \case VRight vi -> do diff --git a/lib/GHCup.hs b/lib/GHCup.hs index dd56d7b..f8b6b41 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -689,6 +689,7 @@ installHLSBin :: ( MonadMask m , MonadFail m ) => Version + -> Maybe FilePath -> Excepts '[ AlreadyInstalled , CopyError @@ -704,9 +705,9 @@ installHLSBin :: ( MonadMask m ] m () -installHLSBin ver = do +installHLSBin ver isoFilepath = do dlinfo <- liftE $ getDownloadInfo HLS ver - installHLSBindist dlinfo ver + installHLSBindist dlinfo ver isoFilepath -- | Installs stack into @~\/.ghcup\/bin/stack-\@ and