Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • haskell/ghcup-hs
  • ethercrow/ghcup-hs
  • ArturGajowy/ghcup-hs
  • puffnfresh/ghcup-hs
  • Kleidukos/ghcup-hs
  • amesgen/ghcup-hs
  • iyefrat/ghcup-hs
  • alessioprestileo/ghcup-hs
  • szabi/ghcup-hs
  • mrtnpaolo/ghcup-hs
  • Anton-Latukha/ghcup-hs
  • mindbat/ghcup-hs
  • Aster89/ghcup-hs
  • jneira/ghcup-hs
  • HuwCampbell/ghcup-hs
  • yaxu/ghcup-hs
  • trac-parsonsmatt/ghcup-hs
  • bgamari/ghcup-hs
  • fendor/ghcup-hs
  • alinab/ghcup-hs
  • cbarrett/ghcup-hs
  • arjun/ghcup-hs
  • DrewFenwick/ghcup-hs
  • tomjaguarpaw1/ghcup-hs
  • emilypi/ghcup-hs
  • juhp/ghcup-hs
  • vglfr/ghcup-hs
  • jhrcek/ghcup-hs
  • peterbecich/ghcup-hs
  • cdsmith/ghcup-hs
  • rae/ghcup-hs
  • Frank-kilo/ghcup-hs
  • fgaz/ghcup-hs
  • tommd/ghcup-hs
  • galp76/ghcup-hs
  • Joyia012/ghcup-hs
  • normalcoder/ghcup-hs
  • Rufflewind/ghcup-hs
  • Malaki846/ghcup-hs
  • andersonsbr/ghcup-hs
  • MorrowM/ghcup-hs
  • jeremybrunson/ghcup-hs
  • drsooch/ghcup-hs
  • badochov/ghcup-hs
  • InfiniteVerma/ghcup-hs
  • why-not-try-calmer/ghcup-hs
  • jaro/ghcup-hs
  • mpilgrem/ghcup-hs
  • fishtreesugar/ghcup-hs
  • ulysses4ever/ghcup-hs
  • chshersh/ghcup-hs
  • trac-taylorfausak/ghcup-hs
  • 0931665782/ghcup-hs
  • eliadh/ghcup-hs
  • wbadart/ghcup-hs
  • rebeccat/ghcup-hs
  • baig/ghcup-hs
57 results
Show changes
Showing
with 3531 additions and 2336 deletions
This diff is collapsed.
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE RankNTypes #-}
module GHCup.OptParse.Nuke where
import GHCup
import GHCup.Errors
import GHCup.Types
import GHCup.Prelude.Logger
#if !MIN_VERSION_base(4,13,0)
import Control.Monad.Fail ( MonadFail )
#endif
import Control.Monad.Reader
import Control.Monad.Trans.Resource
import Data.Maybe
import Haskus.Utils.Variant.Excepts
import Options.Applicative hiding ( style )
import Prelude hiding ( appendFile )
import System.Exit
import Text.PrettyPrint.HughesPJClass ( prettyShow )
import qualified Data.Text as T
import Control.Exception.Safe (MonadMask)
import Control.DeepSeq
import Control.Exception
import Control.Concurrent (threadDelay)
---------------------------
--[ Effect interpreters ]--
---------------------------
type NukeEffects = '[ NotInstalled, UninstallFailed ]
runNuke :: AppState
-> Excepts NukeEffects (ReaderT AppState m) a
-> m (VEither NukeEffects a)
runNuke s' =
flip runReaderT s' . runE @NukeEffects
------------------
--[ Entrypoint ]--
------------------
nuke :: ( Monad m
, MonadMask m
, MonadUnliftIO m
, MonadFail m
)
=> IO AppState
-> (ReaderT LeanAppState m () -> m ())
-> m ExitCode
nuke appState runLogger = do
s' <- liftIO appState
void $ liftIO $ evaluate $ force s'
runNuke s' (do
lift $ logWarn "WARNING: This will remove GHCup and all installed components from your system."
lift $ logWarn "Waiting 10 seconds before commencing, if you want to cancel it, now would be the time."
liftIO $ threadDelay 10000000 -- wait 10s
lift $ logInfo "Initiating Nuclear Sequence 🚀🚀🚀"
lift $ logInfo "Nuking in 3...2...1"
lInstalled <- lift $ listVersions Nothing (Just ListInstalled)
forM_ lInstalled (liftE . rmTool)
lift rmGhcupDirs
) >>= \case
VRight leftOverFiles
| null leftOverFiles -> do
runLogger $ logInfo "Nuclear Annihilation complete!"
pure ExitSuccess
| otherwise -> do
runLogger $ logError "These Files have survived Nuclear Annihilation, you may remove them manually."
liftIO $ forM_ leftOverFiles putStrLn
pure ExitSuccess
VLeft e -> do
runLogger $ logError $ T.pack $ prettyShow e
pure $ ExitFailure 15
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
packages: ./ghcup.cabal
with-compiler: ghc-8.10.4
optional-packages: ./3rdparty/*/*.cabal
optimization: 2
package streamly
ghc-options: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
package ghcup
ghc-options: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
constraints: http-io-streams -brotli
package libarchive
flags: -system-libarchive
allow-newer: base, ghc-prim, template-haskell
This diff is collapsed.
packages: ./ghcup.cabal
with-compiler: ghc-8.8.4
optional-packages: ./3rdparty/*/*.cabal
optimization: 2
package streamly
ghc-options: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
package ghcup
ghc-options: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
constraints: http-io-streams -brotli
package libarchive
flags: -system-libarchive
allow-newer: base, ghc-prim, template-haskell
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.