Reputation: 1082
I'm trying to use Haskell stack (lts-6.12 resolver) to set up and run a small demo program for Chart. I created the project with stack new
, stack init
, etc. then modified the generated Main.hs
, adding the demo code. I also added the Chart and Chart-cairo packages to the .cabal file and ran stack build
. Lots and lots of packages installed, including Chart and Chart-cairo, judging from the output, and when it was finally done, it tried to compile Main.hs
, but failed with the following errors:
/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.
How can stack be loading these packages successfully, then be somehow unable to find them later? How can it have the nerve (jk) to ask me to put the dependencies in my .cabal file, when it has already obtained them from there to load them in the first place?
Here is the dependency list:
$ 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
Upvotes: 1
Views: 420
Reputation: 52039
If you have both an executable
and library
stanza, try listing
the dependencies in both.
If your executable depends on those dependencies but you've only listed them in your library stanza you'll get that error - dependencies from different stanzas are independent of each other.
Upvotes: 2