Stack 找不到 Chart 或 Chart-cairo,尽管 cabal 文件需要它们

Stack can't find Chart or Chart-cairo, though the cabal file calls for them

我正在尝试使用 Haskell 堆栈(lts-6.12 解析器)来设置 运行 small demo program 图表。我用 stack newstack init 等创建了项目,然后修改了生成的 Main.hs,添加了演示代码。我还将 Chart 和 Chart-cairo 包添加到 .cabal 文件和 运行 stack build。安装了很多包,包括 Chart 和 Chart-cairo,从输出来看,当它最终完成时,它尝试编译 Main.hs,但失败并出现以下错误:

/home/asdf/my-project/app/Main.hs:4:8:
Could not find module ‘Graphics.Rendering.Chart.Easy’
It is a member of the hidden package ‘Chart-1.6@Chart_Cz416CvPROo70VikOoIoki’.
Perhaps you need to add ‘Chart’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.

/home/asdf/my-project/app/Main.hs:5:8:
Could not find module ‘Graphics.Rendering.Chart.Backend.Cairo’
It is a member of the hidden package ‘Chart-cairo-1.6@Chart_I1HGJHEm7pvIiSoYgOrXbq’.
Perhaps you need to add ‘Chart-cairo’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.

堆栈如何成功加载这些包,然后以某种方式以后找不到它们?当它已经从那里获得依赖项并首先加载它们时,它怎么有勇气 (jk) 要求我将依赖项放入我的 .cabal 文件中?

这里是依赖列表:

$ stack list-dependencies
Chart 1.6
Chart-cairo 1.6
StateVar 1.1.0.4
adjunctions 4.3
array 0.5.1.0
base 4.8.2.0
base-orphans 0.5.4
bifunctors 5.2
binary 0.7.5.0
bytestring 0.10.6.0
cairo 0.13.1.1
colour 2.3.3
comonad 4.2.7.2
containers 0.5.6.2
contravariant 1.4
data-default-class 0.0.1
deepseq 1.4.1.1
distributive 0.5.0.2
exceptions 0.8.3
filepath 1.4.0.0
free 4.12.4
ghc-prim 0.4.0.0
hashable 1.2.4.0
hmatrix 0.17.0.2
integer-gmp 1.0.0.0
kan-extensions 4.2.3
lens 4.13
machine-learning 0.1.0.0
mtl 2.2.1
old-locale 1.0.0.7
operational 0.2.3.3
parallel 3.2.1.0
prelude-extras 0.4.0.3
primitive 0.6.1.0
profunctors 5.2
random 1.1
reflection 2.1.2
semigroupoids 5.0.1
semigroups 0.18.1
split 0.2.3.1
stm 2.4.4.1
storable-complex 0.2.2
tagged 0.8.4
template-haskell 2.10.0.0
text 1.2.2.1
time 1.5.0.1
transformers 0.4.2.0
transformers-compat 0.4.0.4
unordered-containers 0.2.7.1
utf8-string 1.0.1.1
vector 0.11.0.0
void 0.7.1

如果您同时拥有 executablelibrary 节,请尝试列出 两者的依赖关系。

如果您的可执行文件依赖于这些依赖项,但您只列出了 他们在你的图书馆节你会得到那个错误 - 来自的依赖 不同的节是相互独立的。