Can I switch the haskell-process-type on during an alive haskell session or when starting a new session?
Switch haskell-process-type between cabal-repl and ghci
585 views Asked by ase At
2
There are 2 answers
2
On
In the end I extended fosskers answer a bit!
A function to toggle the process type:
(defvar haskell-process-use-ghci nil)
(defun haskell-process-toggle ()
"Toggle GHCi process between cabal and ghci"
(interactive)
(if haskell-process-use-ghci
(progn (setq haskell-process-type 'cabal-repl)
(setq haskell-process-use-ghci nil)
(message "Using cabal repl"))
(progn (setq haskell-process-type 'ghci)
(setq haskell-process-use-ghci t)
(message "Using GHCi"))))
and a haskell-mode specific keybinding:
(define-key haskell-mode-map (kbd "C-c C-h C-t") 'haskell-process-toggle)
Yes, just type the following in a buffer and
C-x C-e
it afterwards (assumingcabal-repl
is your default).In my
.emacs
I actually have this to make this easy, since I do this often:Another
C-c C-l
will then load your interactive buffer with the correct mode.EDIT: Using
haskell-mode-map
now.