如果你在一个小集团文件中声明库+可执行部分,而避免了图书馆的双重编译通过把图书馆变成一个hs-source-dirs目录下,你不能用通常运行项目ghci和runhaskell了,特别是如果可执行文件有辅助模块本身.
什么是推荐的项目布局
runhaskell我正在尝试构建一个使用Euterpea的项目.
运行stack build我收到以下错误,建议我需要添加Euterpea到build-depends我的.cabal文件部分.
$ sb
composition-0.1.0.0: build (lib + exe)
Preprocessing library composition-0.1.0.0...
[2 of 2] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/Lib.o )
/home/matthew/backup/composition/composition/src/Lib.hs:5:1: error:
Failed to load interface for ‘Euterpea’
It is a member of the hidden package ‘Euterpea-2.0.4’.
Perhaps you need to add ‘Euterpea’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
-- While building package composition-0.1.0.0 using:
/home/matthew/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 …Run Code Online (Sandbox Code Playgroud) 例如,我已经有一段时间没有使用Haskell了,忘记了const函数的名称,但是记得它的类型签名是a -> b -> a。