使用 stack 与我的系统GHC 8.0.1安装,我收到以下错误:

$ cabal get shuffle
$ cd shuffle
$ stack build --system-ghc --stack-yaml my-stack.yaml shuffle
shuffle-0.1.3.3: configure (lib + exe)
[1 of 2] Compiling Main             ( /tmp/shuffle-0.1.3.3/Setup.hs, /tmp/shuffle-0.1.3.3/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/setup/Main.o )

/tmp/shuffle-0.1.3.3/Setup.hs:21:10: error:
    • Couldn't match expected type ‘UserHooks’
                  with actual type ‘Cabal-  1.24.2.0:Distribution.Simple.UserHooks.UserHooks’
      NB: ‘Cabal-1.24.2.0:Distribution.Simple.UserHooks.UserHooks’
            is defined in ‘Distribution.Simple.UserHooks’
                in package ‘Cabal-1.24.2.0’
          ‘UserHooks’
            is defined in ‘Distribution.Simple.UserHooks’
                in package ‘Cabal-1.24.0.0’
    • In the second argument of ‘($)’, namely ‘uuagcLibUserHook uuagc’
      In the second argument of ‘($)’, namely
        ‘addHook $ uuagcLibUserHook uuagc’
      In the expression:
        defaultMainWithHooks $ addHook $ uuagcLibUserHook uuagc

--  While building package shuffle-0.1.3.3 using:
      /usr/local/bin/ghc --make -odir /tmp/shuffle-0.1.3.3/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/setup -hidir /tmp/shuffle-0.1.3.3/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/setup -i -i. -clear-package-db -global-package-db -package-db=/home/asr/.stack/snapshots/x86_64-linux/lts-7.15/8.0.1/pkgdb -package-db=/tmp/shuffle-0.1.3.3/.stack-work/install/x86_64-linux/lts-7.15/8.0.1/pkgdb -hide-all-packages -package=Cabal-1.24.0.0 -package-id=array-0.5.1.1 -package-id=base-4.9.0.0 -package-id=binary-0.8.3.0 -package-id=bytestring-0.10.8.1 -package-id=containers-0.5.7.1 -package-id=deepseq-1.4.2.0 -package-id=directory-1.2.6.2 -package-id=filepath-1.4.1.0 -package-id=ghc-boot-8.0.1 -package-id=ghc-boot-th-8.0.1 -package-id=ghc-prim-0.5.0.0 -package-id=ghci-8.0.1 -package-id=haskeline-0.7.2.3 -package-id=hoopl-3.10.2.1 -package-id=hpc-0.6.0.3 -package-id=integer-gmp-1.0.0.1 -package-id=network-2.6.3.1-G4Up1CPKbp7DeFsnywOnGG -package-id=network-uri-2.6.1.0-DDHh2FNiPirBRgkuU9DEt2 -package-id=pretty-1.1.3.3 -package-id=process-1.4.2.0 -package-id=rts -package-id=template-haskell-2.11.0.0 -package-id=terminfo-0.4.0.2 -package-id=time-1.6.0.1 -package-id=transformers-0.5.2.0 -package-id=uhc-util-0.1.6.7-L1BUn9NMMzYIrWlUtPHNBC -package-id=unix-2.7.2.0 -package-id=uuagc-0.9.52.1-IIwyYC9tdGhA1gPRBZkcWJ -package-id=uuagc-cabal-1.0.6.0-G8DOi0EgyIL1on8rRTcIWG -package-id=uulib-0.9.22-Kc77nQM8lM76maeFa6Awar -package-id=xhtml-3000.2.1 /tmp/shuffle-0.1.3.3/Setup.hs /home/asr/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /tmp/shuffle-0.1.3.3/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/setup/setup -threaded
    Process exited with code: ExitFailure 1

请注意,上面的错误消息提到了两个版本的Cabal库:

  • Cabal-1.24.0.0(包含在GHC 8.0.1中)

  • Cabal-1.24.2.0(包含在LTS 7.15 Haskell快照中)

my-stack.yaml 文件包含:

$ cat my-stack.yaml 
resolver: lts-7.15

# See http://stackoverflow.com/questions/39564607/error-installing-the-shuffle-library-with-stack.
explicit-setup-deps:
  shuffle: true

# Local packages, usually specified by relative directory name
packages:
- '.'
extra-deps:
- logict-state-0.1.0.2
- pqueue-1.3.2
- uhc-util-0.1.6.7
- uuagc-0.9.52.1
- uuagc-cabal-1.0.6.0
- uulib-0.9.22

我可以通过将 Cabal-1.24.0.0 (来自GHC的版本)添加到上面的 extra-deps 来构建包,但我不明白为什么它是必要的 .

堆栈版本:

$ stack --version
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpac