I'm trying to set up haskell-mode following this instructions
[0] https://github.com/haskell/haskell-mode/wiki/Haskell-Interactive-Mode-Setup
[1] http://tim.dysinger.net/posts/2014-02-18-haskell-with-emacs.html
but when I try to bring the REPL in a .hs file I'm getting the following error:
Starting inferior `cabal repl' process using cabal ...
-> :set prompt "\4"
-> Prelude.putStrLn ""
-> :set -v1
<- cabal: unrecognised command: repl (try --help)
Event: "exited abnormally with code 1
"
I have the "cabal repl" working.
Do you know what I'm missing?
Thanks!
Edit:
I followed these steps [1]:
$ cabal --v
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library
$ cabal install happy alex
$ cabal install ghc-mod structured-haskell-mode stylish-haskell
$ mkdir haskell-hello
$ cd haskell-hello
$ cabal init
$ touch LICENSE
$ cabal sandbox init
$ perl -p -i -e 's/^.*main-is.*$/ main-is: Main.hs/' haskell-hello.cabal
$ echo 'main = putStrLn "hello world"' > Main.hs
$ cabal install
$ ./.cabal-sandbox/bin/haskell-hello
hello world
Then I open the Main.hs in Emacs. In haskell-mode I try to open a REPL with haskell-process-load-or-reload
or haskell-interactive-bring
but this error appears:
<- cabal: unrecognised command: repl (try --help)
I have cabal repl
working:
$ cabal repl
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>
Edit 2:
When I eval
(process-lines "cabal repl")
I have the following result
apply: Searching for program: no such file or directory, cabal repl
Edit 3:
My haskell configuration on .emacs:
;; haskell
(require-package 'haskell-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(eval-after-load "haskell-mode"
'(progn
(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)))
(define-key haskell-mode-map [f7] 'haskell-navigate-imports)
(custom-set-variables '(haskell-stylish-on-save t))
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
(custom-set-variables '(haskell-process-type 'cabal-repl))
(setq haskell-ghci-program-name "cabal")
(setq haskell-ghci-program-args '("repl"))
(custom-set-variables
'(haskell-process-suggest-remove-import-lines t)
'(haskell-process-auto-import-loaded-modules t)
'(haskell-process-log t))
(define-key haskell-mode-map (kbd "C-c C-g") 'haskell-interactive-bring)
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
(define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
(define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
(define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)
M-: (process-lines "cabal repl")
? Probably your Emacs uses another, outdatedcabal
…haskell-mode
on emacs and the rest of the packages withcabal
. I have added also my haskell configuration.(process-lines "cabal" "--v")
. This should give you the version of the cabal binary Emacs uses. This should include the string1.20.0.3
.