1

I recently updated Cabal to version 1.22, before installing ghc-mod so I could get some much needed error-checking in my projects.

The update didn't come without complications, ghc-mod wouldn't even run before I had added the path of the latest version of Cabal to $PATH. Upon doing so, haskell-mode started acting up, as loading the interpreter no longer greeted me with the familiar phrase "Your command is my IO", but instead appeared to be the standard GHCI. Not only that, but it didn't ask if I wanted to start a new project named haskell like it usually did prior to the change; and with that, all the glorious autocompletion was gone.

After a bit of fiddling around I learned that Emacs had trouble loading haskell-interactive-mode, being told it had something to do with haskell-mode itself, I installed it anew, and added

(require 'haskell-mode)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
(eval-after-load "auto-complete"
  '(add-to-list 'ac-modes 'haskell-interactive-mode))

to my .emacs file, and suddenly the error was gone, however the problem persists, and now whenever I try loading the interpreter, Emacs will ask me to provide a path to Cabal, then the current working directoryl; after which I'll be greeted by the repl that used to enable the autocompletion.

Except... it still doesn't autocomplete. Or rather, it autocompletes whatever's in the document, but it doesn't reveal functions as I type, it doesn't show me sub-modules like it used to, it doesn't do anything at all, except auto-generate type signatures when I press C-u C-c C-t.

I really have no idea how to go by from here, and would really appreciate some help.

16
  • Put the haskell library in your load-path and require it. See the Emacs manual for how to require libraries.
    – Drew
    Jan 8, 2015 at 2:22
  • @Drew I have no idea what you mean by haskell library... do you mean the ghc path, or the haskell mode path? Jan 8, 2015 at 5:05
  • 1
    What version of GHC do you use? Perhaps it's this issue: github.com/kazu-yamamoto/ghc-mod/issues/417 - ghc-mod only works with Cabal 1.22 if you use GHC 7.10 (the format of the 'setup-config' file ghc-mod parses changed to binary). I had similar problems in Vim and went back to the last Cabal version and now ghc-mod works again. Jan 8, 2015 at 9:22
  • @RüdigerHanke I have GHC 7.6.3, and Cabal 1.22 Jan 8, 2015 at 9:33
  • Then that could be the problem. Does ghc-mod work from the command line? Check if the file "dist/setup-config" in your cabal project is binary now. That would cause the error "[path]/dist/setup-config: hGetContents: invalid argument (invalid byte sequence)" when starting ghc-mod. As I understand it, the solution is either to upgrade to GHC 7.10 or go back to an older Cabal. Jan 8, 2015 at 9:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.