Haskell Stack构建特定的可执行文件 [英] Haskell Stack build specific executable

查看:143
本文介绍了Haskell Stack构建特定的可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何构建特定的堆栈可执行文件,即在projectname.cabal中指定的内容,例如:

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

我需要编译executable-name,而无需其他.就像这样:

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

stack build --executable executable-name

推荐答案

堆栈使用基于组件的查找,例如

stack build packagename:component-type:component-name

因此,如果您的程序包称为"foo",而可执行文件称为"bar",则可以使用

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

stack build foo:exe:bar

但是,如果组件名称是唯一的,则可以删除程序包的名称和组件类型.因此,如果您的可执行文件称为"exectuable-name",则为

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

这篇关于Haskell Stack构建特定的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆