5

I work with Haskell stack and found the --file-watch opton, but was then surprised that it works for build but not for run. Searching on the web indicates that there are some ways to achieve the effects of stack run --file-watch with other commands (script?), but I could not find a simple, straightforward solution. Is there one?

wohlstad
  • 12,661
  • 10
  • 26
  • 39
user855443
  • 2,596
  • 3
  • 25
  • 37

1 Answers1

3

Use --exec COMMAND [ARGUMENT(S)] for stack build

From stack build --help:

--exec COMMAND [ARGUMENT(S)]

Command and argument(s) to run after a successful build

So, finally

stack build --file-watch --exec COMMAND

The name of executable file is specified in package.yaml (or .cabal)

AsL
  • 31
  • 1
  • 2