Pra*_*nti 6 haskell haskell-stack
我正在尝试从名为“Trial”的同一个 haskell 堆栈项目生成两个可执行文件。\n我的堆栈项目的结构如下:
\n\n$~/trial$ tree\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 app\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 First.hs\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Second.hs\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 ChangeLog.md\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 LICENSE\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package.yaml\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 README.md\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Setup.hs\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Lib.hs\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 stack.yaml\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 stack.yaml.lock\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 test\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Spec.hs\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 trial.cabal\nRun Code Online (Sandbox Code Playgroud)\n\n我提到了一个类似的问题:从单个项目生成多个可执行文件\n并且我相应地编辑了我的项目的\'.cabal\'文件...\n
\nTrial.cabal:
\n-- This file has been generated from package.yaml by hpack version 0.31.2.\n--\n-- see: https://github.com/sol/hpack\n--\n-- hash: ff6e15c6d7d9cfb9abc0b852e25bb43f131a2a80acf4b08356d5c574b951fb8c\n\nname: trial\nversion: 0.1.0.0\ndescription: Please see the README on GitHub at <https://github.com/githubuser/trial#readme>\nhomepage: https://github.com/githubuser/trial#readme\nbug-reports: https://github.com/githubuser/trial/issues\nauthor: Author name here\nmaintainer: example@example.com\ncopyright: 2020 Author name here\nlicense: BSD3\nlicense-file: LICENSE\nbuild-type: Simple\nextra-source-files:\n README.md\n ChangeLog.md\n\nsource-repository head\n type: git\n location: https://github.com/githubuser/trial\n\nlibrary\n exposed-modules:\n Lib\n other-modules:\n Paths_trial\n hs-source-dirs:\n src\n build-depends:\n base >=4.7 && <5\n\n default-language: Haskell2010\n\nexecutable first\n main-is: First.hs\n other-modules:\n Paths_trial\n\n hs-source-dirs: app\n ghc-options: -O2 -threaded -with-rtsopts=-N -main-is First.hs\n build-depends:\n base >=4.7 && <5\n , trial\n default-language: Haskell2010\n\nexecutable second\n main-is: Second.hs\n other-modules:\n Paths_trial\n hs-source-dirs: app\n ghc-options: -threaded -rtsopts -with-rtsopts=-N -main-is Second.hs\n build-depends:\n base >=4.7 && <5\n , trial\n default-language: Haskell2010\n\ntest-suite trial-test\n type: exitcode-stdio-1.0\n main-is: Spec.hs\n other-modules:\n Paths_trial\n hs-source-dirs:\n test\n ghc-options: -threaded -rtsopts -with-rtsopts=-N\n build-depends:\n base >=4.7 && <5\n , trial\n default-language: Haskell2010\nRun Code Online (Sandbox Code Playgroud)\n\napp/First.hs 和 app/Second.hs 的内容相同,如下:
\n\nimport Lib\nmain :: IO()\nmain = someFunc\nRun Code Online (Sandbox Code Playgroud)\n\nsrc/Lib.hs内容如下:
\n\nmodule Lib\n ( someFunc\n ) where\n\nsomeFunc :: IO ()\nsomeFunc = putStrLn "someFunc"\nRun Code Online (Sandbox Code Playgroud)\n\n当我构建项目时,出现以下错误:
\n\n error:\n output was redirected with -o, but no output will be generated\nbecause there is no Second module.\n\n\n-- While building package trial-0.1.0.0 using:\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
231 次 |
| 最近记录: |