Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Stack build specific executable

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
like image 588
EliuX Avatar asked Mar 21 '16 17:03

EliuX


1 Answers

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
like image 158
Zeta Avatar answered Sep 30 '22 14:09

Zeta