Hi i am starting with haskell and trying to set up my emacs for its development.
I have haskell-mod
and ghc-mod
latest in emacs 24.3.1
. GHC is 7.6.3
i have created a haskell file first.hs and when i do C-c C-l
It asks :
start a new project named haskell ? y or n
my directory name is haskell. I press y
Set the cabal directory
I have tried with both ~/.cabal and my current directory named haskell
Set the current directory
Just pressed enter as it has haskell directory
It shows error messages :
haskell-process-start: cl-ecase failed: cabal-rep, (ghci quote cabal-repl quote cabal-ghci quote cabal-dev quote)
How can i get the repl ?
I read that i may need to downgrad the ghc version to make it work. Is that good solution ?
Solution :
I had multiple custom-set-variables
in init.el and it led to the problem.
UPDATE 2017
now that we have Intero I would suggest you try Intero/Stack - it works rather well.
With it my config is slimmed even more down:
Concerning the REPL you basically just load the file and then
C-c C-l
into the repl (you can always switch between the two windows withC-c C-z
and you can clear out the repl-buffer withC-c C-k
(when inside).The only drawback is that Intero is usually installed locally in your project, so the first startup into a new project will take a while for Intero to download/compile/boot-up - but it's no big deal and you gain much.
UPDATE
Now that
stack
is out and running great I would recommend setting thehaskell-process-type
toauto
and maybe installingghc-mod
using stack.here is the current setup I am using:
As you can see I basically got rid of all
ghc-mod
related stuff (stack works as is with the currenthaskell-mode
) and replaced thecompany
backend (although this one is really slow and I hope to find something better)variables
Theses you usually set within Emacs/Configuration of Haskell-Mode
These are the packages I added:
:i
)First
if it asks for your cabal directory - it wants to know where your
myProject.cabal
file is - if you don't have one just take the folder where your file is (the default - I think the default/find never failed me till now).in case you need some sample-.emacs-setup
Here are parts from my
.emacs
file that works for me:Please note the part with
(quote cabal-repl)
- this should work with cabal sandboxes. Also this will add more logging information to a buffer named haskell-process-log where you might find more about your problem.I use this with
ghc-mod version 5.1.0.2 compiled by GHC 7.8.3
and GHC 7.8.3 obviously.Of course you have to make sure that your
.cabal
folder and the place whereghc-mod
is in your path (I think you can configure this somewhere in the emacs settings too - but it's much easier this way).remarks
ghc
in emacs notghc-mod
.further information
If this does not help you please feel free to
sample run on my machine
I edited a sample file like this:
Then I hit C-c C-l and press y:
And accept the folder (this is where the file is located) and any other questions with Ret - now you should see the
*haskell*
buffer with a friendly message/lambda:Finally I can check that the file got loaded: