我为haskell在我的电脑上安装了堆栈:
Developers-MacBook-Pro:~ developer$ stack ghci
Configuring GHCi with the following packages:
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /private/var/folders/2x/t_2cl03x2092dkzvc702d7lc0000gn/T/ghci2170/ghci-script
Prelude> 如您所见,版本仍然是8.0.1。然后,我对堆栈进行了如下升级:
Developers-MacBook-Pro:~ developer$ stack upgrade
Current Stack version: 1.3.2, available download version: 1.4.0
Newer version detected, downloading
Querying for archive location for platform: osx-x86_64-static
Querying for archive location for platform: osx-x86_64
Downloading from: https://github.com/commercialhaskell/stack/releases/download/v1.4.0/stack-1.4.0-osx-x86_64.tar.gz
Download complete, testing executable
Version 1.4.0, Git revision e714f1dd3fade19496d91bd6a017e435a96a6bcd (4640 commits) x86_64 hpack-0.17.0
New stack executable available at /Users/developer/.local/bin/stack 在我再次启动stack ghci并获得8.0.1版本之后,我做错了什么?
图像显示,ghci版本8.0.2已成功安装:

路径是/Users/developer/.stack/programs/x86_64-osx/
在路径 /Users/developer/.stack/中,有一个名为global-project的文件夹,我将yaml更改如下:

现在,在8.0.2版本上运行堆栈ghci:
Developers-MBP:~ developer$ stack ghci
Configuring GHCi with the following packages:
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /private/var/folders/2x/t_2cl03x2092dkzvc702d7lc0000gn/T/ghci526/ghci-script发布于 2018-02-10 07:07:38
GHC的版本以及可以安装的软件包由解析器指定。
因此,要更改在执行stack ghci外部堆栈项目时使用的GHC版本,请执行以下操作:
~/.stack/build-plan中找到一个现有的解析器,例如lts-10.4,或者下载您需要的新解析器;stack config set resolver lts-10.4。是的,它更新了~/.stack/global-project/stack.yaml。因此,stack ghci外部堆栈项目将使用GHC8.2.2,这是解析器lts-10.4指定的GHC版本(这种关系可以在https://www.stackage.org/lts-10.4中找到,或者在文件~/.stack/build-plan/lts-10.4.yaml中显示ghc-version: '8.2.2')。
发布于 2017-06-03 17:11:40
stack是一个构建工具,用于协调使用不同版本的GHC和依赖项集构建项目。因此,您可以独立于ghc升级stack。
当stack ghci在项目目录之外运行时,我不太确定它的预期行为是什么。您可能会将默认版本的ghc配置为在这种情况下在~/.stack/config.yaml中使用。请参阅:configuration/
你还应该能够:
$ stack ghci --with-ghc ghc-7.10.3但是,通常情况下,ghc的版本是由您为项目配置的堆栈快照决定的,例如,如果您有一个具有:
resolver: lts-3.3...you将使用ghc-7.10.3
https://stackoverflow.com/questions/44346435
复制相似问题