Haskell Stack build specific executable

痞子三分冷 提交于 2019-12-10 10:24:43

问题


How to build an specific stack executable file, ie. those specified in projectname.cabal, like:

executable executable-name
  hs-source-dirs:      tools
  main-is:             ExecutableModule.hs
  ghc-options:         -Wall -threaded -rtsopts -with-rtsopts=-N
  build-depends:       base
                     , hsass
                     , hlibsass

I would need to compile executable-name and no other. It would be something like:

stack build --executable executable-name

回答1:


Stack uses a component based lookup, e.g.

stack build packagename:component-type:component-name

So if your package is called "foo", and your executable is called "bar", you can use

stack build foo:exe:bar

However, if the component-name is unique, you can drop the package's name and the component type. So if your executable is called "exectuable-name", it's

stack build :executable-name


来源:https://stackoverflow.com/questions/36137310/haskell-stack-build-specific-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!