Stack: Feature request: `stack repl --file-watch`

Created on 20 Feb 2017  ·  6Comments  ·  Source: commercialhaskell/stack

In a directory with stack.yaml (or descendant), stack repl loads up GHCi with project modules. So far so neat.

I suggest to extend the already existing --file-watcher to repl mode where "on change" (as per already implemented file checks) either a :reload\n could be sent via the sub-process' stdin or the running ghci killed and restarted as if stack repl were invoked. Would be incredible for productivity in all .. "sub-customizable" editors out there!

ghci enhancement

Most helpful comment

 $ stack ghci --with-ghc=ghcid
ddb-0.1.0.0: initial-build-steps (lib + exe)
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: ddb
Using main module: 1. Package `ddb' component exe:ddb-exe with main-is file: /Users/cyber/dev/ddb/app/Main.hs
Unknown flag: --interactive

All 6 comments

In the meantime, https://github.com/ndmitchell/ghcid is worth a look!

I really think it's more job for ghcid (or stack ghcid). Reloading repl on external event seems defeat purposes of repl...

Agreed, I don't think we necessarily want to extend stack's feature scope to include this, so closing. IIRC, stack ghci --with-ghc=ghcid works quite nicely.

Maybe alias stack ghcid to stack ghci --with-ghc=ghcid?
Personally I'd love to have this feature for live editing/testing of code

 $ stack ghci --with-ghc=ghcid
ddb-0.1.0.0: initial-build-steps (lib + exe)
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: ddb
Using main module: 1. Package `ddb' component exe:ddb-exe with main-is file: /Users/cyber/dev/ddb/app/Main.hs
Unknown flag: --interactive

@revmischa Did you ever figure out how to fix the Unknown flag: --interactive error?

Was this page helpful?
0 / 5 - 0 ratings