I have stack installed on my computer for 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>
As you can see version is still 8.0.1. Then I upgraded the stack as follow:
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
After I start stack ghci
again and I've got still version 8.0.1, what am I doing wrong?
The image shows, that ghci
version 8.0.2 has successfully installed:
The path is /Users/developer/.stack/programs/x86_64-osx/
Update
In the path /Users/developer/.stack/
, there is a folder called global-project
and I change the yaml as follow:
Now stack ghci run on version 8.0.2:
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
According to https://docs.haskellstack.org/en/stable/faq/#what-version-of-ghc-is-used-when-i-run-something-like-stack-ghci,
The version of GHC, as well as which packages can be installed, are specified by the resolver.
So, to change the version of GHC used when executing stack ghci
outside stack projects, do:
Find an existing resolver in ~/.stack/build-plan
, e.g. lts-10.4
, or download a new resolver you need;
Execute stack config set resolver lts-10.4
. Yes it updates ~/.stack/global-project/stack.yaml
.
As thus, stack ghci
outside stack projects will use GHC 8.2.2, which is the GHC version specified by resolver lts-10.4
(This relationship can be found at https://www.stackage.org/lts-10.4, or in file ~/.stack/build-plan/lts-10.4.yaml
which says ghc-version: '8.2.2'
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With