Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I find the GHC version from inside GHCi?

Tags:

haskell

ghci

λ> 

What do I type within GHCi to discover which GHC version it is using?

like image 694
dmvianna Avatar asked Jun 02 '21 02:06

dmvianna


People also ask

How do I find my GHC version?

The version number of your copy of GHC can be found by invoking ghc with the --version flag (see Verbosity options).

Where does stack install GHC?

In its default configuration, Stack will simply ignore any system GHC installation and use a sandboxed GHC that it has installed itself. You can find these sandboxed GHC installations in the ghc-* directories in the stack path --programs directory.

How do I run Haskell in GHC?

Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)


1 Answers

> import System.Info
> :browse
arch :: String
compilerName :: String
compilerVersion :: Data.Version.Version
os :: String
> compilerVersion
Version {versionBranch = [8,10], versionTags = []}
> compilerName
"ghc"

On top of that, GHCi prints its version on startup:

GHCi, version 8.10.3: https://www.haskell.org/ghc/  :? for help
like image 137
chi Avatar answered Oct 10 '22 05:10

chi