How to avoid recompiling in this cabal file?

后端 未结 1 492
慢半拍i
慢半拍i 2020-12-28 15:28

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

相关标签:
1条回答
  • 2020-12-28 16:14

    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.

    0 讨论(0)
提交回复
热议问题