Better Informatics - Troubleshooting Haskell

Better Informatics

Troubleshooting Haskell

Emacs: Haskell has died

One reason for the error `The Haskell process `haskell' has died. Restart?' is that Emacs cannot find the location of the GHCi executable.

The following fix will find this location and add it to the Emacs path. Note that the solution given is only for OS X / Linux, but has only been tested on OS X.

Also note that any number of problems seem to produce the same error, so this is not guaranteed to work (but when done correctly seemed to work for most students at the session on Friday).

  • Open a terminal.
  • execute the following command:
    which ghci
  • If you get an error from this command, Haskell has not been installed correctly. Otherwise, note the response given (eg. /opt/local/bin/ghci)
  • The path that must be added to the Emacs path is the above response, but with /ghci removed (eg. /opt/local/bin).
  • Copy the following two lines to the end of your Emacs config file:
    (setenv "PATH" (concat (getenv "PATH") ":HERE"))
    (setq exec-path (append exec-path '("HERE")))
  • Replace HERE with the path described above.
  • Restart Emacs.

Note that the Emacs config file is usually located at the path `~/.emacs'.

You can also access the Emacs config file by executing the following within Emacs:

M-: (find-file user-init-file)

import Test.QuickCheck doesn't work!

Open up the command line / Terminal, and type cabal install quickcheck

"I'm doing cabal install quickcheck, but it doesn't work because of something related to satisfying packages... random-1-1...?"

Solution: Try sudo ghc-pkg recache. Then try cabal install quickcheck again.

Send us feedback