One of the features I missed when coming from a Scala/SBT toolset to a Stack/Haskell toolset was the continuous running of tasks in SBT, through the ~ operator. For example to continuously compile production sources we could use:

~compile

from within SBT.

For a while there I was stumped about how to do the same for Stack. That was until I stumbled across it in the documentation under Build Synonyms:

stack build --pedantic --haddock --test --exec "echo Yay, it succeeded" --file-watch

The flag of interest is –file–watch. Now I can continuously watch for file changes against library or test sources and run commands accordingly:

stack build --file-watch

or

stack test --file-watch

respectively.