diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index b4d0fee..59ed48c 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -48,6 +48,8 @@ import System.Exit import System.IO.Unsafe import URI.ByteString +import qualified GHCup.Types as GT + import qualified Data.Text as T import qualified Graphics.Vty as Vty import qualified Data.Vector as V @@ -480,11 +482,6 @@ changelog' BrickState { appData = BrickData {..} } (_, ListResult {..}) = do Left e -> pure $ Left [i|#{e}|] -uri' :: IORef (Maybe URI) -{-# NOINLINE uri' #-} -uri' = unsafePerformIO (newIORef Nothing) - - settings' :: IORef AppState {-# NOINLINE settings' #-} settings' = unsafePerformIO $ do @@ -513,13 +510,11 @@ logger' = unsafePerformIO brickMain :: AppState - -> Maybe URI -> LoggerConfig -> GHCupDownloads -> PlatformRequest -> IO () -brickMain s muri l av pfreq' = do - writeIORef uri' muri +brickMain s l av pfreq' = do writeIORef settings' s -- logger interpreter writeIORef logger' l @@ -548,7 +543,6 @@ defaultAppSettings = BrickSettings { showAll = False } getDownloads' :: IO (Either String GHCupDownloads) getDownloads' = do - muri <- readIORef uri' settings <- readIORef settings' l <- readIORef logger' let runLogger = myLoggerT l @@ -559,7 +553,7 @@ getDownloads' = do . runE @'[JSONError , DownloadFailed , FileDoesNotExistError] $ fmap _ghcupDownloads $ liftE - $ getDownloadsF (maybe GHCupURL OwnSource muri) + $ getDownloadsF (urlSource . GT.settings $ settings) case r of VRight a -> pure $ Right a diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index beff0df..19484ae 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1349,7 +1349,7 @@ Report bugs at |] res <- case optCommand of #if defined(BRICK) - Interactive -> liftIO $ brickMain appstate optUrlSource loggerConfig dls pfreq >> pure ExitSuccess + Interactive -> liftIO $ brickMain appstate loggerConfig dls pfreq >> pure ExitSuccess #endif Install (Right iopts) -> do runLogger ($(logWarn) [i|This is an old-style command for installing GHC. Use 'ghcup install ghc' instead.|])