Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use `cabal repl` instead of `ghci` in `ghc-mod`?

I want to use cabal repl to instead of ghci (. My goal is being able to use other modules in my project ).

like image 650
AmirHossein Avatar asked Aug 30 '14 08:08

AmirHossein


People also ask

How to edit GHCi file from terminal?

I would recommend using an editor in a separate terminal, and using :r to reload, but :e can still be useful for quick edits from within GHCi. :set editor vim ... -- rest of file ... -- Use :rr to reload this file. :def! rr \_ -> return ":script ~/.ghci" -- Turn on output of types.

What is GHCi used for in Haskell?

GHCi and the continual typechecking tool called ghcid are useful for fast feedback loops while you code, but GHCi has a lot of other features besides. This is a very basic introduction to some of those. You open a new GHCi session with the ghci command.

What is the use of ghcid?

GHCi and the continual typechecking tool called ghcid are useful for fast feedback loops while you code, but GHCi has a lot of other features besides. This is a very basic introduction to some of those.


3 Answers

My setups uses this:

(setq haskell-program-name "cabal repl")
(setq haskell-ghci-program-name "cabal repl")
(custom-set-variables
 ;; ...
 '(haskell-process-type 'cabal-repl)
 ;; ...
)

concerning ghc and cabal and is running fine as it is (current ghc-mod and emacs 24.3.1)

like image 106
Random Dev Avatar answered Oct 08 '22 12:10

Random Dev


GHC-mod has an issue about this, where the author suggests changing the GHCi executable:

(setq haskell-ghci-program-name "cabal")
(setq haskell-ghci-program-args '("repl"))
like image 20
Tikhon Jelvis Avatar answered Oct 08 '22 13:10

Tikhon Jelvis


You should consider to setup Haskell Interactive Mode.

Unlike Inferior Haskell Mode, this mode is deeply integrated into Cabal. It does not only use cabal repl, but also interprets Cabal error messages and suggests to add imports or language extensions, and provides completion for modules.

like image 29
lunaryorn Avatar answered Oct 08 '22 14:10

lunaryorn