[Git][ghc/ghc][wip/amg/T26037] ghci: Mention active language edition in startup banner

Adam Gundry pushed to branch wip/amg/T26037 at Glasgow Haskell Compiler / GHC Commits: d099d2e9 by Adam Gundry at 2025-06-05T07:50:57+02:00 ghci: Mention active language edition in startup banner Per GHC proposal 632, this makes the GHCi startup banner include the active language edition, plus an indication of whether this was the default (as opposed to being explicitly selected via an option such as `-XGHC2024`). For example: ``` $ ghci GHCi, version 9.14.1: https://www.haskell.org/ghc/ :? for help Using default language edition: GHC2024 ghci> ``` Fixes #26037. - - - - - 2 changed files: - ghc/GHCi/UI.hs - ghc/Main.hs Changes: ===================================== ghc/GHCi/UI.hs ===================================== @@ -28,7 +28,8 @@ module GHCi.UI ( GhciSettings(..), defaultGhciSettings, ghciCommands, - ghciWelcomeMsg + ghciWelcomeMsg, + languageEditionMsg ) where -- GHCi @@ -199,6 +200,10 @@ ghciWelcomeMsg :: String ghciWelcomeMsg = "GHCi, version " ++ cProjectVersion ++ ": https://www.haskell.org/ghc/ :? for help" +languageEditionMsg :: Maybe Language -> String +languageEditionMsg Nothing = "Using default language edition: " ++ show defaultLanguage +languageEditionMsg (Just lang) = "Using language edition: " ++ show lang + ghciCommands :: [Command] ghciCommands = map mkCmd [ -- Hugs users are accustomed to :e, so make sure it doesn't overlap ===================================== ghc/Main.hs ===================================== @@ -38,7 +38,7 @@ import GHC.Platform import GHC.Platform.Host #if defined(HAVE_INTERNAL_INTERPRETER) -import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings ) +import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings, languageEditionMsg ) #endif import GHC.Runtime.Loader ( loadFrontendPlugin, initializeSessionPlugins ) @@ -334,7 +334,9 @@ showBanner _postLoadMode dflags = do #if defined(HAVE_INTERNAL_INTERPRETER) -- Show the GHCi banner - when (isInteractiveMode _postLoadMode && verb >= 1) $ putStrLn ghciWelcomeMsg + when (isInteractiveMode _postLoadMode && verb >= 1) $ + do putStrLn ghciWelcomeMsg + putStrLn $ languageEditionMsg (language dflags) #endif -- Display details of the configuration in verbose mode View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d099d2e9d93fb3a21c42d846d2b642d5... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d099d2e9d93fb3a21c42d846d2b642d5... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Adam Gundry (@adamgundry)