ghciwatch icon indicating copy to clipboard operation
ghciwatch copied to clipboard

Toggle reinterpreting modules to evaluate private top-level binds

Open theGhostJW opened this issue 6 months ago • 4 comments

Describe the feature you’d like to be implemented

Currently if I have evals in place like this:

-- $> hello
hello :: IO ()
hello = T.putStrLn "Hello"

-- $> world
world :: IO ()
world = T.putStrLn "World"

and I kick off ghciwatch

ghciwatch \
  --log-filter info \
  --before-startup-shell 'hpack --force' \
  --restart-glob package.yaml \
  --command 'cabal repl --repl-no-load' \
  --watch src --watch test --watch examples --watch testIntegration \
  --allow-eval --clear --backtrace full

after making a change to the file i get this:

• examples/WebDriverDemo.hs:185:7: hello
[1 of 1] Compiling WebDriverDemo    ( examples/WebDriverDemo.hs, interpreted )
Ok, one module loaded.
Hello
• examples/WebDriverDemo.hs:189:7: world
[1 of 1] Compiling WebDriverDemo    ( examples/WebDriverDemo.hs, interpreted )
Ok, one module loaded.
World

It seems ghci is being reloaded once for prior to each evaluation even though only one change has been made to the file.

It would be great if ghciwatch only reloaded once so I got this (quicker and less noisy):

• examples/WebDriverDemo.hs:185:7: hello
[1 of 1] Compiling WebDriverDemo    ( examples/WebDriverDemo.hs, interpreted )
Ok, one module loaded.
Hello
World

List alternatives to the feature and their pros and cons

No response

Additional context

Current behaviour is slower and noisier than that requested. This is particularly true if you temporarily living with multiple warnings (such as undefined somewhere in code) in this part of the dev cycle.

theGhostJW avatar Aug 30 '24 01:08 theGhostJW