How to make Stack create only one executable? stack build: exe1 not working?

I have several executables in one of my Stack projects:

executable m1
  hs-source-dirs:      src
  main-is:             Main1.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5

executable m2
  hs-source-dirs:      src
  main-is:             Main2.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5

I would like to build only one of them at a time. From the documentation and this other question, it would seem that the following command should work:

stack build :m2

but what actually happens is that both executable files, m1 and m2, are always created regardless of whether I include the package name, package type, etc.

What could be the reason for this?

+4
source share
1 answer

This is currently not possible. See https://github.com/commercialhaskell/stack/issues/1406

+3

All Articles