This method is OS, GHC version, and editor agnostic.
Enable docker in your stack.yaml file. This is optional. If this causes issues in later steps disable it.
# stack.yaml
docker:
enable: true
Set up direnv to use the paths given by stack.
# .envrc
export PATH=$(/usr/local/bin/stack path --bin-path)
$ direnv allow .
Install ghcid and copy it to directory for compiler tools
$ stack build --copy-compiler-tool ghcid
Run the following command while editing code in your favorite editor
$ ghcid --command "stack repl" --test ":main"
Leave a comment