I installed haskell-mode
and I want to launch the REPL GHCi with the command C-c C-z
.
However, on typing C-c C-z
, it shows error Could not find any installation of GHC.
And when I use same command again, it launches a new window with what looks like ghci. But when I try to type and execute something, it shows an error "haskell-process" has died as below. (If it matters at all, there is a tests.cabal
in the directory where the current open file resides)
If I enter y
then it throws the same error as above about GHC not being found.
Now I have my GHC, Stack, Cabal, and HLS installations managed through GHCup. Therefore by default, I only have the ghcup path in the system PATH
variable.
Since many places online said that there needs to be the ghc path in the PATH
, I added the line export PATH=$PATH:/home/axiom/.ghcup/bin/ghc
to my .bashrc
. But this didn't fix anything.
Further, I looked for other solutions and tried two more things:
I added the following lines in my .emacs.d/init.el
:
(setenv "PATH" (concat "/home/axiom/.ghcup/bin/ghc" (getenv "PATH")))
(setq exec-path (append '("/home/axiom/.ghcup/bin/ghc") exec-path))
Adding this also didn't solve anything.
Then I replaced the above lines with (setq haskell-process-path-ghci "/home/axiom/.ghcup/bin/ghc")
and this didn't help either.
I think the error Could not find any installation of GHC.
is being returned from a piece of code in this file https://github.com/haskell/haskell-mode/blob/master/haskell-customize.el but I am not able to figure out how to fix my system according to what the haskell-mode
code is trying to do before throwing the above error.
PATH
andexec-path
are lists of directories. My impression is that you are adding the path to the specific executable, rather than its parent directory.