[英]haskell-stack: main module to load is ambiguous
I have multiple executables with non-conflicting names.我有多个名称不冲突的可执行文件。 Yet stack ghci
complains that the main module is ambiguous:然而stack ghci
抱怨主模块不明确:
$ find . -type f -exec grep -Hi "apple\|banana" {} \; | grep -v work
./ambig.cabal:executable apple
./ambig.cabal: main-is: Apple.hs
./ambig.cabal: ghc-options: -main-is Apple.apple
./ambig.cabal:executable banana
./ambig.cabal: main-is: Banana.hs
./ambig.cabal: ghc-options: -main-is Banana.banana
./src/Apple.hs:module Apple (apple) where
./src/Apple.hs:apple :: IO ()
./src/Apple.hs:apple = putStrLn "I am apple"
./src/Banana.hs:module Banana (banana) where
./src/Banana.hs:banana :: IO ()
./src/Banana.hs:banana = putStrLn "I am banana"
$ stack ghci
The main module to load is ambiguous. Candidates are: [...]
$ stack --version
Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e
How can I make stack ghci
load all these non-conflicting modules?如何让stack ghci
加载所有这些不冲突的模块?
The complete cabal file:完整的 cabal 文件:
$ cat ambig.cabal
name: ambig
version: 0.1.0.0
build-type: Simple
cabal-version: >=1.10
executable apple
hs-source-dirs: src
main-is: Apple.hs
ghc-options: -main-is Apple.apple
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
executable banana
hs-source-dirs: src
main-is: Banana.hs
ghc-options: -main-is Banana.banana
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
I had the same problem, if I translate what I did on mine onto your project, you should be able to do either of these to choose the main module:我遇到了同样的问题,如果我将我在我的项目中所做的转换为您的项目,您应该能够执行以下任一操作来选择主模块:
stack ghci --main-is ambig:exe:apple
or或
stack ghci --main-is ambig:exe:banana
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.