My project structure is as follows:
~/.../project_name
project_name.cabal
Setup.hs
src/
Main.hs
Data/
...
test/
MainTestSuite
...
I have (amongst others) the following lines in my project.cabal
:
build-type: Simple
...
executable project_name
main-is: Main.hs
...
hs-source-dirs: src
When I cabal configure
(works fine) and then cabal build
I get the error message:
cabal: can't find source for Setup in src, dist/build/autogen
It works when I put Source.hs
in src
but this seems messy to me and I haven't seen this in other projects, where Source.hs
is always in the project root. How do I get cabal
to find Source.hs
?
As an aside: What's the purpose of Source.hs
anyways?
hs-source-dirs: ., src
comes to mind as a fast fix.
That's what my projects use, and I generate my cabal files automatically (so I suppose that's the default).
The problem was caused by accidently adding the Source
file as a dependency in other-modules
in the cabal
-file of the project ... that caused all the trouble.
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