Open adrian-gierakowski opened 5 years ago
Nope, and it would be hard to do since ghcid assumes it has complete control over the session, so has done crazy things like giving it a weird prompt etc. It's not completely infeasible, since ghcid could give you its own session and proxy them on, but its not in the plans.
Thank you for explanation.
When you say "its not in the plans" is it because you don't think it would be useful, or because you'd rather focus hour efforts somewhere else? If the latter, would you accept a PR implementing it?
My focus is elsewhere, I think it could be quite a significant piece of work, I think there are a lot of trade offs, and I'm not convinced the end result will be that nice. That said, if you make a PR, the PR doesn't overly complicate stuff, and it works reasonably enough, I'm happy - it is something quite a lot of people ask for.
That said, I do wonder if something that reloads would be better integrated into ghci itself, since you are taking the prompt bits from ghci and the reloading from ghcid - and the combination involves much more ghci.
Glad I found this issue, I totally thought ghcid
was a repl enhancement, and was pulling my hair out trying to solve why it was broken.
"GHCi as a daemon" or "GHC + a bit of an IDE". it opens ghci and runs :reload
So ghcid
basically just compiles your code to give you ghc's error output, only, it does so automatically, and actually interpreting is faster to do than compiling, so it does that instead.
One more thing I just discovered surfing the issues, is the flag --allow-eval
.
Thanks for letting me know @freckletonj - it's not an unreasonable confusion - I've updated the README to say you can't use the ghci it spawns: https://github.com/ndmitchell/ghcid/blob/master/README.md. There is an active ticket for documenting --allow-eval
.
my 2 cents on this topic: you can use inotifywait
in conjunction with tmux
to automate pretty much anything and emulate a part of what ghcid does:
inotifywait -e create -e close_write -rm src | xargs -L1 -I{} \
tmux send-keys -R -t 1.2 :r enter
would clear the repl (-R
) and reload the sources (:r enter
) everytime something changed in the src
folder.
You first need to run your repl in a tmux pane (in my example located at 1.2
).
Hope it helps :)
@docteurklein thanks for the tip!
is it possible to drop into interactive repl session after successful loading/reloading?
thanks!