我如何确定我的GHC版本?

Die*_*Saa 25 haskell version ghc

这可能是一个非常愚蠢的问题,但我似乎无法找到答案......

mhe*_*rzl 24

为了找到我stack正在使用的版本,我跑了

$ stack ghc -- --version
Run Code Online (Sandbox Code Playgroud)

得到了

$ stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
Run Code Online (Sandbox Code Playgroud)

  • 很好用的双连字符!也可以与沙盒版ghc一起使用! (2认同)
  • 警告:如果您没有安装 `ghc`,此命令将下载近 200MB 的文件并在您的系统中安装 `ghc`。 (2认同)

Die*_*Saa 19

ghc --version 在Ubuntu上做了伎俩,感谢Karolis!

编辑:也适用于Mac(macOS Sierra 10.12.6)


Ske*_*cal 5

根据您的安装方法和体系结构,某些命令可能会有所不同。有些人可能安装了多个版本。以下是一些可能有用的信息:

堆栈版本

? stack --version
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2
Run Code Online (Sandbox Code Playgroud)

ghc 版本(如@mherzl 所述

? stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
Run Code Online (Sandbox Code Playgroud)

标准 ghc 版本命令

? ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.1
Run Code Online (Sandbox Code Playgroud)

阴谋集团版本

? cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library
Run Code Online (Sandbox Code Playgroud)

GHC 的回复

? ghci --version
The Glorious Glasgow Haskell Compilation System, version 8.8.1
Run Code Online (Sandbox Code Playgroud)

如果使用带有-fllvm标志的llvm

? llvm-gcc -v
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Run Code Online (Sandbox Code Playgroud)