[Git][ghc/ghc][master] GHCi: add a :version command.
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 44354255 by Vo Minh Thu at 2026-02-20T18:53:06-05:00 GHCi: add a :version command. This looks like: ghci> :version GHCi, version 9.11.20240322 This closes #24576. Co-Author: Markus Läll <markus.l2ll@gmail.com> - - - - - 3 changed files: - + docs/users_guide/10.0.1-notes.rst - docs/users_guide/ghci.rst - ghc/GHCi/UI.hs Changes: ===================================== docs/users_guide/10.0.1-notes.rst ===================================== @@ -0,0 +1,36 @@ +.. _release-10-0-1: + +Version 10.0.1 +============== + +Language +~~~~~~~~ + +Compiler +~~~~~~~~ + +GHCi +~~~~ + +- Added the :ghci-cmd:`:version` command. This displays the current GHC version. + +Runtime system +~~~~~~~~~~~~~~ + +``base`` library +~~~~~~~~~~~~~~~~ + +``ghc-prim`` library +~~~~~~~~~~~~~~~~~~~~ + +``ghc`` library +~~~~~~~~~~~~~~~ + +``ghc-heap`` library +~~~~~~~~~~~~~~~~~~~~ + +``template-haskell`` library +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Included libraries +~~~~~~~~~~~~~~~~~~ ===================================== docs/users_guide/ghci.rst ===================================== @@ -3140,6 +3140,10 @@ commonly used commands. The :ghci-cmd:`:uses` command requires :ghci-cmd:`:set +c` to be set. +.. ghci-cmd:: :version + + Display the current GHC version. + .. ghci-cmd:: :where Show the current evaluation stack while stopped at a breakpoint. ===================================== ghc/GHCi/UI.hs ===================================== @@ -193,9 +193,11 @@ defaultGhciSettings = fullHelpText = defFullHelpText } +versionString :: String +versionString = "GHCi, version " ++ cProjectVersion + ghciWelcomeMsg :: String -ghciWelcomeMsg = "GHCi, version " ++ cProjectVersion ++ - ": https://www.haskell.org/ghc/ :? for help" +ghciWelcomeMsg = versionString ++ ": https://www.haskell.org/ghc/ :? for help" ghciCommands :: [Command] ghciCommands = map mkCmd [ @@ -253,6 +255,7 @@ ghciCommands = map mkCmd [ ("unadd", keepGoingPaths unAddModule, completeFilename), ("undef", keepGoing undefineMacro, completeMacro), ("unset", keepGoing unsetOptions, completeSetOptions), + ("version", keepGoing showVersion', noCompletion), ("where", keepGoing whereCmd, noCompletion), ("instances", keepGoing' instancesCmd, completeExpression) ] ++ map mkCmdHidden [ -- hidden commands @@ -366,6 +369,7 @@ defFullHelpText = " :type +d <expr> show the type of <expr>, defaulting type variables\n" ++ " :unadd <module> ... remove module(s) from the current target set\n" ++ " :undef <cmd> undefine user-defined command :<cmd>\n" ++ + " :version display the current GHC version\n" ++ " ::<cmd> run the builtin command\n" ++ " :!<command> run the shell command <command>\n" ++ " :shell <command> run shell via sh -c <command>\n" ++ @@ -3626,6 +3630,9 @@ unsetOptions str no_flags <- mapM no_flag minus_opts when (not (null no_flags)) $ newDynFlags False no_flags +showVersion' :: GhciMonad m => String -> m () +showVersion' _ = liftIO (putStrLn versionString) + isMinus :: String -> Bool isMinus ('-':_) = True isMinus _ = False View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44354255ce5d5df51c84834bff646745... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44354255ce5d5df51c84834bff646745... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)