I\'ve been working on this Haskell project, and I have a cabal file for it. Now, my project is structured as a library that implements a simple interpreter. I also have a ve
In your executable section, add the library in Build-Depends
so that the executable depends on the library.
There's a small gotcha, though: You also have to move the Main.hs
of the executable (and any other source files specific to the executable) to a different subdirectory and specify a different Hs-Source-Dirs
so that it doesn't pick up the library modules by being in the same folder.
executable HaSC
Build-Depends: HaSC
Main-Is: Main.hs
Hs-Source-Dirs: foo -- Directory you moved Main.hs to
For this to work, you will need to specify Cabal-Version >= 1.8
. See Cabal ticket #89 for the details.