From 236da31af6f92eb0703cbab8f19da3e38afc3c58 Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Sun, 25 Jul 2021 21:24:50 +0530 Subject: [PATCH] updates usages of new `installCabalBindist` across files. --- app/ghcup/BrickMain.hs | 2 +- app/ghcup/Main.hs | 35 ++++++++++++++--------------------- lib/GHCup.hs | 5 +++-- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index 17acc9e..129a5cb 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -451,7 +451,7 @@ install' _ (_, ListResult {..}) = do liftE $ installGHCBin lVer Nothing $> vi Cabal -> do let vi = getVersionInfo lVer Cabal dls - liftE $ installCabalBin lVer $> vi + liftE $ installCabalBin lVer Nothing $> vi GHCup -> do let vi = snd <$> getLatest dls GHCup liftE $ upgradeGHCup Nothing False $> vi diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index f43de0e..c1246ae 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1673,27 +1673,20 @@ Report bugs at |] let installCabal InstallOptions{..} = - (case isolateDir of - Just isoDir -> - runInstTool instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer Cabal - let cabalVersion = (_tvVersion v) - liftE $ installCabalBinIsolated isoDir cabalVersion - pure vi - Nothing -> - case instBindist of - Nothing -> runInstTool instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer Cabal - liftE $ installCabalBin (_tvVersion v) - pure vi - Just uri -> do - s' <- appState - runInstTool' s'{ settings = settings { noVerify = True}} instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer Cabal - liftE $ installCabalBindist - (DownloadInfo uri Nothing "") - (_tvVersion v) - pure vi + (case instBindist of + Nothing -> runInstTool instPlatform $ do + (v, vi) <- liftE $ fromVersion instVer Cabal + liftE $ installCabalBin (_tvVersion v) isolateDir + pure vi + Just uri -> do + s' <- appState + runInstTool' s'{ settings = settings { noVerify = True}} instPlatform $ do + (v, vi) <- liftE $ fromVersion instVer Cabal + liftE $ installCabalBindist + (DownloadInfo uri Nothing "") + (_tvVersion v) + isolateDir + pure vi ) >>= \case VRight vi -> do diff --git a/lib/GHCup.hs b/lib/GHCup.hs index c5e381a..3820eaf 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -545,6 +545,7 @@ installCabalBin :: ( MonadMask m , MonadFail m ) => Version + -> Maybe FilePath -- isolated install Path, if user provided any -> Excepts '[ AlreadyInstalled , CopyError @@ -560,9 +561,9 @@ installCabalBin :: ( MonadMask m ] m () -installCabalBin ver = do +installCabalBin ver isoFilepath = do dlinfo <- liftE $ getDownloadInfo Cabal ver - installCabalBindist dlinfo ver + installCabalBindist dlinfo ver isoFilepath -- | Like 'installHLSBin, except takes the 'DownloadInfo' as