diff --git a/cabal-install/src/Distribution/Client/Init/FileCreators.hs b/cabal-install/src/Distribution/Client/Init/FileCreators.hs index 18ea0bc71a1..f53ce7a6e53 100644 --- a/cabal-install/src/Distribution/Client/Init/FileCreators.hs +++ b/cabal-install/src/Distribution/Client/Init/FileCreators.hs @@ -65,7 +65,7 @@ writeProject (ProjectSettings opts pkgDesc libTarget exeTarget testTarget) message opts T.Error "no package name given, so no .cabal file can be generated\n" | otherwise = do -- clear prompt history a bit" - message opts T.Log $ + message opts T.Info $ "Using cabal specification: " ++ showCabalSpecVersion (_optCabalSpec opts) @@ -269,7 +269,7 @@ writeFileSafe opts fileName content = do go exists - message opts T.Log $ show action ++ " file " ++ fileName ++ "..." + message opts T.Info $ show action ++ " file " ++ fileName ++ "..." return $ action == Existing where doOverwrite = _optOverwrite opts @@ -279,7 +279,7 @@ writeFileSafe opts fileName content = do writeFile fileName content | exists && doOverwrite = do newName <- findNewPath fileName - message opts T.Log $ + message opts T.Info $ concat [ fileName , " already exists. Backing up old version in " @@ -302,7 +302,7 @@ writeDirectoriesSafe opts dirs = fmap or $ for dirs $ \dir -> do go dir exists - message opts T.Log $ show action ++ " directory ./" ++ dir ++ "..." + message opts T.Info $ show action ++ " directory ./" ++ dir ++ "..." return $ action == Existing where doOverwrite = _optOverwrite opts @@ -312,7 +312,7 @@ writeDirectoriesSafe opts dirs = fmap or $ for dirs $ \dir -> do createDirectory dir | exists && doOverwrite = do newDir <- findNewPath dir - message opts T.Log $ + message opts T.Info $ concat [ dir , " already exists. Backing up old version in " diff --git a/cabal-install/src/Distribution/Client/Init/Types.hs b/cabal-install/src/Distribution/Client/Init/Types.hs index 41513d0f048..ee7d7cbe0c3 100644 --- a/cabal-install/src/Distribution/Client/Init/Types.hs +++ b/cabal-install/src/Distribution/Client/Init/Types.hs @@ -368,7 +368,7 @@ instance Interactive IO where hFlush = System.IO.hFlush message q severity msg | q == silent = pure () - | otherwise = putStrLn $ "[" ++ show severity ++ "] " ++ msg + | otherwise = putStrLn $ "[" ++ displaySeverity severity ++ "] " ++ msg break = return False throwPrompt = throwM @@ -407,7 +407,7 @@ instance Interactive PurePrompt where Error -> PurePrompt $ \_ -> Left $ BreakException - (show severity ++ ": " ++ msg) + (displaySeverity severity ++ ": " ++ msg) _ -> return () break = return True @@ -455,7 +455,13 @@ newtype BreakException = BreakException String deriving (Eq, Show) instance Exception BreakException -- | Used to inform the intent of prompted messages. -data Severity = Log | Info | Warning | Error deriving (Eq, Show) +data Severity = Info | Warning | Error deriving (Eq) + +displaySeverity :: Severity -> String +displaySeverity severity = case severity of + Info -> "Info" + Warning -> "Warn" + Error -> "Err" -- | Convenience alias for the literate haskell flag type IsLiterate = Bool diff --git a/cabal-install/src/Distribution/Client/Init/Utils.hs b/cabal-install/src/Distribution/Client/Init/Utils.hs index e8cde1184ae..f986cce0e03 100644 --- a/cabal-install/src/Distribution/Client/Init/Utils.hs +++ b/cabal-install/src/Distribution/Client/Init/Utils.hs @@ -214,7 +214,7 @@ retrieveDependencies v flags mods' pkgIx = do modDeps = map (\(mn, ds) -> (mn, ds, M.lookup ds modMap)) mods -- modDeps = map (id &&& flip M.lookup modMap) mods - message v Log "Guessing dependencies..." + message v Info "Guessing dependencies..." nub . catMaybes <$> traverse (chooseDep v flags) modDeps -- Given a module and a list of installed packages providing it, diff --git a/changelog.d/pr-9346 b/changelog.d/pr-9346 new file mode 100644 index 00000000000..3f31da43837 --- /dev/null +++ b/changelog.d/pr-9346 @@ -0,0 +1,12 @@ +synopsis: remove +packages: cabal-install +prs: #9346 +issues: #9151 +significance: significant + +description: { + +- Remove "Log" as a log level in favour of "Info". +- Remove "Show" in Severity and replace by "displaySeverity" function + +}