I have follow this cmd:

check ghc on PATH

root@9a79ab5e17cb:~# ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

setup stack global ghc version

root@9a79ab5e17cb:~# stack setup 7.10.3
stack will use the GHC on your PATH
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

after set stack global resolver:

cat /root/.stack/global-project/stack.yaml  
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: lts-7.10

install happy fail >.<

root@9a79ab5e17cb:~# stack install happy
Run from outside a project, using implicit global project config
Using resolver: lts-7.10 from implicit global project's config file: /root/.stack/global-project/stack.yaml
Compiler version mismatched, found ghc-7.10.3 (x86_64), but expected minor version match with ghc-8.0.1 (x86_64) (based on resolver setting in /root/.stack/global-project/stack.yaml).
Try running "stack setup" to install the correct GHC into /root/.stack/programs/x86_64-linux/

How can I change stack ghc global version?

Question author Lorancechen | Source



The error message is telling you that you are using GHC 7.10.3 but lts-7.10 is meant for GHC 8.0.1. You can do one of two things:

  • Keep GHC 7.10.3 and change your revolver to lts-6.26 (the newest resolver for 7.10.3 as of December 2, 2016)
  • Do what it suggests and run stack setup. That will automatically install GHC 8.0.1 since that is what your resolver is expecting.
Answer author Alec