how to achieve `stack run --file-watch`
Asked Answered
U

1

7

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?

Uncut answered 3/4, 2021 at 8:56 Comment(0)
C
6

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)

Crater answered 4/1, 2022 at 5:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.