parsonsmatt / hasktuts

A collection of introductory tutorials on Haskell libraries
MIT License
43 stars 2 forks source link

Haskell development Environment Setup for Spacemacs tutorial #8

Open soupi opened 9 years ago

soupi commented 9 years ago

Can someone write a step by step tutorial on how to setup a good Haskell development environment for Spacemacs for beginner users of Spacemacs?

Thanks in advance!

ajnsit commented 9 years ago

Spacemacs comes with solid Haskell support built in, you simply need to enable it in your layers config. I wrote a comment on reddit with some notes - https://www.reddit.com/r/haskell/comments/3jww0s/can_you_post_your_emacs_configuration_for/cut7u3q

soupi commented 9 years ago

Saying "you simply need to enable it in your layers config" is exactly what I'd like a tutorial for. I haven't used Emacs or Spacemacs so I haven't got a clue on what I need to do.

ajnsit commented 9 years ago

Ah, apologies :) I understand how difficult it can be to simply get started.

In absence of a complete tutorial, see if these steps make sense to you -

  1. Assuming you have spacemacs installed and running, use <SPC> : dotspacemacs/install to generate a .spacemacs configuration file.
  2. Run the following command to start editing the config file - <SPC> f e d
  3. In your config file, look for the section which starts with dotspacemacs-configuration-layers '(. It should have a list of default layers. If the list is 'all then haskell is already enabled. Else, add haskell to the list.
  4. Press : w q to exit. Then restart emacs. Spacemacs should start installing the haskell mode files. It may ask you to restart emacs once or twice.
  5. You would need to open a Haskell file from your project to be in haskell mode. The first time you do that (per project), ghc-mod will configure and build your project.

That's it! You would also need to have ghc-mod, hindent, and cabal executables on your $PATH so emacs can pick them up. How to do that is platform dependent.

soupi commented 9 years ago

Thank you for your reply, though I did have some hard time setting things up. I did as you suggested but only got syntax highlighting and indentation. after also adding haskell-mode after haskell I also got "go to definition` and hoogle support, but no type error checks and auto completion. Also, I had a problem when running spacemacs that it did not get pass the initialization stage but somehow this got fix. now everytime I open a Haskell file I get stuck at "Initializing" until I press some buttons (maybe C-g?). I'm not really sure what causing these problems or how to fix them :I

ajnsit commented 9 years ago

Hmm looks like https://github.com/kazu-yamamoto/ghc-mod/issues/575. Did you look at the notes I wrote on Reddit? It gives a potential solution.

On Saturday 12 September 2015, suppi notifications@github.com wrote:

Thank you for your reply, though I did have some hard time setting things up. I did as you suggested but only got syntax highlighting and indentation. after also adding haskell-mode after haskell I also got "go to definition` and hoogle support, but no type error checks and auto completion. Also, I had a problem when running spacemacs that it did not get pass the initialization stage but somehow this got fix. now everytime I open a Haskell file I get stuck at "Initializing" until I press some buttons (maybe C-g?). I'm not really sure what causing these problems or how to fix them :I

— Reply to this email directly or view it on GitHub https://github.com/parsonsmatt/hasktuts/issues/8#issuecomment-139796265.

Sent from my hyper-communicator

mrkgnao commented 9 years ago

Hey, @soupi asked me to share any solution I might have here. Here's a Reddit post in which I detail my setup. Everything works now, with stack. I just have to get the hang of Emacs and everything now. :)