Hacker News new | comments | show | ask | jobs | submit login
Using Emacs for Haskell development (github.com)
86 points by lelf on Aug 24, 2014 | hide | past | web | favorite | 11 comments

There's no need to restart Emacs for a trivial config change; you just M-x eval-buffer RET and go on about your business, and I've opened a pull request with a patch which updates the document to reflect that fact. (You do still want to restart after something like a major package update, because not every module author is good about making sure that his code can be initialized more than once per session, and the patch reflects that fact as well.)

Thanks for the article! I have been happily using just haskell-mode for a long time, but as soon as I get back home from my vacation with my grand kids I will work through the suggestions.

I have been using various Lisps professionally since 1981 and the more I use Haskell, it seems like just another Lisp but with a different syntax, because of the interactive, bottom up development style.

Nice writeup!

I've always wondered why functional programming-people seem to prefer emacs over vim? I guess it could be the choice for people wanting more IDE-like features, and aren't afraid of a little bloat(cause surely it can't just be the lisp in the configs), am I right?

Disclaimer: I'm a Haskeller who prefers Vim.

I think the reason for Emacs dominance is mostly historical: early on it was probably due to good capability for integrating a REPL process. Also since it is written in a lisp and can be grown organically to fit almost any purpose it developed an ecosystem of useful tools more quickly than Vim - attracting more developers who further developed tooling.

Today the only feature you can't get in Vim that Emacs has is structured haskell mode. I haven't used that enough to know if its worth the switch...

I DID try to switch and while none of this is a real show-stopper and it all could be fixed - I spent a dozen hours on trying to get an Emacs setup with all the features I have in Vim and simply couldn't. For example the auto-complete plugins do not list the type signatures in the pop-up window like neco-ghc does and there is nothing that comes close to fugitive. Also Emacs has an hdevtools plugin for flycheck but I doubt its used much because it doesn't even have a way to pass command line arguments so I had to go hack that in myself. Hdevtools is a killer feature, having instant compilation feedback is incredibly useful in Haskell...it makes it so easy to use the type system interactively while designing a new module. I did get hdevtools to work eventually but I would have to learn emacs lisp to get it working right and since there are other gaps I never put in the effort. I could never figure out how to launch a ghci process with custom arguments...I want the damn REPL to be launched with cabal repl so that it has the same environment as my code and ... I'm sure its easy if you know what you are doing, but I spent at least a couple of hours on that alone and failed. I spent probably 3-4 hours getting Evil working the way I want, things like imap keybinds required a lot of research for some reason. I did get it to work though...Emacs without Evil is not even a contender in mind - modal editing is just way to powerful and my left pinky will be out the goddamn door if I make it pound chords all day.

Switching is hard, especially if you're coming from Vim and don't have any pre-existing familiarity with Lisp. I know nothing about Haskell and barely more than that about Vim, but I do know quite a fair bit about Emacs and Lisp, and I would be interested in an opportunity to work with someone who's trying to switch; between someone who knows what Haskell and its associated ecosystem should be doing, and me who knows how to make Emacs do what's necessary for said ecosystem to behave itself properly, I expect we could end up with a pretty smooth process for Haskellers interested in making the jump to Emacs.

(Oh, and parenthetically, I would mention that rebinding your Caps Lock key to an additional Control key helps a lot with the pinky situation. Sure, you still work that finger harder than you do with a modal editor, but you no longer have to cramp your hand to do so, and after a little while getting used to it -- I advise disabling the "real" Control key, or rebinding it to do nothing but emit a nasty noise -- you no longer think about it at all.)

> and there is nothing that comes close to fugitive.

I have never used fugitive, but I can't imagine being unhappy with Magit? What makes fugitive so much better?

I am a vim-er and I decided that I will stick to one editor and that will be vim. I don't want to spent more time on learning one more editor. Emacs may be great but I made my choice and I want to stick to it.

For some time I wanted dive into haskell, and could not afford time, but recently I am getting some time freed up.

Can you suggest, how to set up vim for haskell like any plugins or scripts for better development experience.

As a side not this video(https://www.youtube.com/watch?v=ScS8Q32lMxA) of live haskell coding in vim looks interesting.

I highly recommend haskell-vim-now [1]. The author has a nice demo showcasing this setup, along with his virtual pair-coding environment [2].

With one install command, you get a polished Vim/Haskell setup with tab completion, type inspection, Hoogle, hinting, unicode symbols, etc.

Also has a nice dark theme. In fact, I use it as my go-to Vim configuration on new systems, even outside of Haskell.

It also lets you pipe code to the Haskell REPL for live evaluation (via tmux).

[1] https://github.com/begriffs/haskell-vim-now [2] https://www.youtube.com/watch?v=7sr8cAIwdBs

EDIT: Add video

That installation script is horrifying! I'm sure it has saved some people a lot of time, but it's a terrible idea to point anyone to it who already has an existing vim config.

For me (used to use vim and moved to emacs) it was the ability to have a full programming language behind me which made me feel like I could truly customise every feature of the editor I wanted. Incidentally, if you do want to switch you don't have to give up your vim keybindings, there is evil-mode[0] which gives you all the bindings you're used to

[0] https://gitorious.org/evil/pages/Home

See also http://www.haskell.org/haskellwiki/Yi

Hehe. The "linux tiling wm" and "emacs-like editor" fads were cooler the current one ("our own javascript ui framework").

Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact