diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 8b8e008..163962b 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1702,7 +1702,10 @@ Make sure to clean up #{tmpdir} afterwards.|]) else putStrLn uri' >> pure ExitSuccess Nuke -> do - putStrLn "Nuking in 3...2....1" + putStrLn "Initiating Nuclear Sequence... " + lInstalled <- runLogger . flip runReaderT appstate $ listVersions Nothing (Just ListInstalled) + forM_ lInstalled $ runLogger . flip runReaderT appstate . rmTool + putStrLn "Nuking in 3...2...1" putStrLn "BOOM!" pure ExitSuccess diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 372a422..2a03f9c 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -1282,6 +1282,40 @@ rmStackVer ver = do Nothing -> liftIO $ rmLink (binDir "stack" <> exeExt) +rmTool :: ( MonadReader AppState m + , MonadLogger m + , MonadFail m + , MonadMask m + , MonadUnliftIO m) + => ListResult + -> m () + +rmTool tool = do + let ListResult {lVer, lTool, lCross} = tool + -- appstate <- ask + + case lTool of + GHC -> do + let ghcTargetVersion = GHCTargetVersion lCross lVer + _ <- runE @'[NotInstalled] $ rmGHCVer ghcTargetVersion + pure () + + HLS -> do + _ <- runE @'[NotInstalled] $ rmHLSVer lVer + pure () + + Cabal -> do + _ <- runE @'[NotInstalled] $ rmCabalVer lVer + pure () + + Stack -> do + _ <- runE @'[NotInstalled] $ rmStackVer lVer + pure () + + GHCup -> do + -- leaving this unimplemented for now. + pure () + ------------------ --[ Debug info ]--